1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00
This commit is contained in:
suyuan 2025-03-04 17:07:57 +00:00 committed by GitHub
commit 8ac566cb0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 468 additions and 0 deletions

29
.gitignore vendored Normal file
View file

@ -0,0 +1,29 @@
*.o
.DS_Store
.*.swp
/env
/dl
/.config
/.config.old
/bin
/build_dir
/staging_dir
/tmp
/logs
/feeds
/feeds.conf
/files
/overlay
/package/feeds
/package/openwrt-packages
key-build*
*.orig
*.rej
*~
.#*
*#
.emacs.desktop*
TAGS*~
git-src
.git-credentials
/*.log

68
frp/Makefile Executable file
View file

@ -0,0 +1,68 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=frp
PKG_VERSION:=0.48.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/fatedier/frp/tar.gz/v${PKG_VERSION}?
PKG_HASH:=efba8ec9fad3369ce62631369f52b78a7248df426b5b54311e96231adac5cc76
PKG_MAINTAINER:=Richard Yu <yurichard3839@gmail.com>
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_DEPENDS:=golang/host
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
GO_PKG:=github.com/fatedier/frp
GO_PKG_BUILD_PKG:=github.com/fatedier/frp/cmd/...
include $(INCLUDE_DIR)/package.mk
include $(TOPDIR)/feeds/openmptcprouter/golang/golang-package.mk
define Package/frp/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/$(2) $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/frp/$(2).d/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/conf/$(2)_full.ini $(1)/etc/frp/$(2).d/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) ./files/$(2).config $(1)/etc/config/$(2)
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) ./files/$(2).init $(1)/etc/init.d/$(2)
if [ -r ./files/$(2).uci-defaults ]; then \
$(INSTALL_DIR) $(1)/etc/uci-defaults; \
$(INSTALL_DATA) ./files/$(2).uci-defaults $(1)/etc/uci-defaults/$(2); \
fi
endef
define Package/frp/template
define Package/$(1)
SECTION:=net
CATEGORY:=Network
SUBMENU:=Web Servers/Proxies
TITLE:=$(1) - fast reverse proxy $(2)
URL:=https://github.com/fatedier/frp
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
define Package/$(1)/description
$(1) is a fast reverse proxy $(2) to help you expose a local server behind
a NAT or firewall to the internet.
endef
define Package/$(1)/conffiles
/etc/config/$(1)
endef
define Package/$(1)/install
$(call Package/frp/install,$$(1),$(1))
endef
endef
$(eval $(call Package/frp/template,frpc,client))
$(eval $(call Package/frp/template,frps,server))
$(eval $(call BuildPackage,frpc))
$(eval $(call BuildPackage,frps))

28
frp/files/frpc.config Executable file
View file

@ -0,0 +1,28 @@
config init
option stdout 1
option stderr 1
option user frpc
option group frpc
option respawn 1
config conf 'common'
option server_addr routev2.55860.com
option server_port 4443
option token daf96d69f52ec4aef2ac6abcf363fc41
option authentication_method token
option admin_addr 0.0.0.0
option admin_port 7400
option admin_user admin
option admin_pwd 17603766659
config conf '60230200115'
option type http
option local_port 80
option subdomain 60230200115
config conf 'ssh_random'
option type tcp
option local_ip 127.0.0.1
option local_port 22
option remote_port 0
option bandwidth_limit 1MB

80
frp/files/frpc.init Executable file
View file

@ -0,0 +1,80 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
NAME=frpc
PROG=/usr/bin/$NAME
_err() {
echo "$*" >&2
logger -p daemon.err -t "$NAME" "$*"
}
config_cb() {
[ $# -eq 0 ] && return
local type="$1"
local name="$2"
if [ "$type" = "conf" ]; then
echo "[$name]" >> "$conf_file"
option_cb() {
local option="$1"
local value="$2"
[ "$option" = "name" ] && \
sed -i "s/$CONFIG_SECTION/$value/g" "$conf_file" || \
echo "$option = $value" >> "$conf_file";
}
list_cb() {
local name="$1"
local value="$2"
[ "$name" = "_" ] && echo "$value" >> "$conf_file"
}
else
[ "$type" = "init" ] && init_cfg="$name"
option_cb() { return 0; }
list_cb() { return 0; }
fi
}
service_triggers()
{
procd_add_reload_trigger "$NAME"
}
start_service() {
local init_cfg=" "
local conf_file="/var/etc/$NAME.ini"
> "$conf_file"
config_load "$NAME"
local stdout stderr user group respawn env conf_inc
uci_validate_section "$NAME" init "$init_cfg" \
'stdout:bool:1' \
'stderr:bool:1' \
'user:string' \
'group:string' \
'respawn:bool:1' \
'env:list(string)' \
'conf_inc:list(string)'
local err=$?
[ $err -ne 0 ] && {
_err "uci_validate_section returned $err"
return 1
}
[ -n "$conf_inc" ] && config_list_foreach "$init_cfg" conf_inc cat >> "$conf_file"
procd_open_instance
procd_set_param command "$PROG" -c "$conf_file"
procd_set_param file $conf_file
procd_set_param stdout $stdout
procd_set_param stderr $stderr
[ -n "$user" ] && procd_set_param user "$user"
[ -n "$group" ] && procd_set_param group "$group"
[ $respawn -eq 1 ] && procd_set_param respawn
[ -n "$env" ] && config_list_foreach "$init_cfg" env "procd_append_param env"
procd_close_instance
}

19
frp/files/frpc.uci-defaults Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
. /lib/functions.sh
upgrade() {
local section=$1
local name
[ "$section" != "common" ] || return 0
config_get name $section name
if [ -z "$name" ]; then
uci_set frpc "$section" name "$section"
uci_commit frpc
fi
}
config_load frpc
config_foreach upgrade conf
exit 0

16
frp/files/frps.config Executable file
View file

@ -0,0 +1,16 @@
config init
option stdout 1
option stderr 1
option user frps
option group frps
option respawn 1
# OS environments pass to frp for config file template, see
# https://github.com/fatedier/frp#configuration-file-template
# list env 'ENV_NAME=value'
# Config files include in temporary config file.
# list conf_inc '/etc/frp/frps.d/frps_full.ini'
config conf 'common'
option bind_port 7000
# List options with name="_" will be directly appended to config file
# list _ '# Key-A=Value-A'

78
frp/files/frps.init Executable file
View file

@ -0,0 +1,78 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
NAME=frps
PROG=/usr/bin/$NAME
_err() {
echo "$*" >&2
logger -p daemon.err -t "$NAME" "$*"
}
config_cb() {
[ $# -eq 0 ] && return
local type="$1"
local name="$2"
if [ "$type" = "conf" ]; then
echo "[$name]" >> "$conf_file"
option_cb() {
local option="$1"
local value="$2"
echo "$option = $value" >> "$conf_file"
}
list_cb() {
local name="$1"
local value="$2"
[ "$name" = "_" ] && echo "$value" >> "$conf_file"
}
else
[ "$type" = "init" ] && init_cfg="$name"
option_cb() { return 0; }
list_cb() { return 0; }
fi
}
service_triggers()
{
procd_add_reload_trigger "$NAME"
}
start_service() {
local init_cfg=" "
local conf_file="/var/etc/$NAME.ini"
> "$conf_file"
config_load "$NAME"
local stdout stderr user group respawn env conf_inc
uci_validate_section "$NAME" init "$init_cfg" \
'stdout:bool:1' \
'stderr:bool:1' \
'user:string' \
'group:string' \
'respawn:bool:1' \
'env:list(string)' \
'conf_inc:list(string)'
local err=$?
[ $err -ne 0 ] && {
_err "uci_validate_section returned $err"
return 1
}
[ -n "$conf_inc" ] && config_list_foreach "$init_cfg" conf_inc cat >> "$conf_file"
procd_open_instance
procd_set_param command "$PROG" -c "$conf_file"
procd_set_param file $conf_file
procd_set_param stdout $stdout
procd_set_param stderr $stderr
[ -n "$user" ] && procd_set_param user "$user"
[ -n "$group" ] && procd_set_param group "$group"
[ $respawn -eq 1 ] && procd_set_param respawn
[ -n "$env" ] && config_list_foreach "$init_cfg" env "procd_append_param env"
procd_close_instance
}

3
frp/test.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
$1 -v 2>&1 | grep -F "$PKG_VERSION"

69
rtty/Makefile Executable file
View file

@ -0,0 +1,69 @@
#
# Copyright (C) 2018 Jianhui Zhao
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=rtty
PKG_VERSION:=8.0.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL=https://github.com/zhaojh329/rtty/releases/download/v$(PKG_VERSION)
PKG_HASH:=b1a21819c2256b3364b8c64dfcc56583b9647409ab8b39ff54e00e242e44028e
PKG_MAINTAINER:=Jianhui Zhao <zhaojh329@gmail.com>
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/rtty/Default
TITLE:=Access your terminals from anywhere via the web
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Terminal
URL:=https://github.com/zhaojh329/rtty
DEPENDS:=+libev $(2)
VARIANT:=$(1)
PROVIDES:=rtty
endef
Package/rtty-openssl=$(call Package/rtty/Default,openssl,+PACKAGE_rtty-openssl:libopenssl)
Package/rtty-wolfssl=$(call Package/rtty/Default,wolfssl,+PACKAGE_rtty-wolfssl:libwolfssl)
Package/rtty-mbedtls=$(call Package/rtty/Default,mbedtls,+PACKAGE_rtty-mbedtls:libmbedtls +PACKAGE_rtty-mbedtls:zlib)
Package/rtty-nossl=$(call Package/rtty/Default,nossl)
define Package/rtty-openssl/conffiles
/etc/config/rtty
endef
Package/rtty-wolfssl/conffiles = $(Package/rtty-openssl/conffiles)
Package/rtty-mbedtls/conffiles = $(Package/rtty-openssl/conffiles)
Package/rtty-nossl/conffiles = $(Package/rtty-openssl/conffiles)
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DUSE_OPENSSL=ON
else ifeq ($(BUILD_VARIANT),wolfssl)
CMAKE_OPTIONS += -DUSE_WOLFSSL=ON
else ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DUSE_MBEDTLS=ON
else
CMAKE_OPTIONS += -DSSL_SUPPORT=OFF
endif
define Package/rtty-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/rtty $(1)/usr/sbin
$(INSTALL_BIN) ./files/rtty.init $(1)/etc/init.d/rtty
$(INSTALL_CONF) ./files/rtty.config $(1)/etc/config/rtty
endef
$(eval $(call BuildPackage,rtty-openssl))
$(eval $(call BuildPackage,rtty-wolfssl))
$(eval $(call BuildPackage,rtty-mbedtls))
$(eval $(call BuildPackage,rtty-nossl))

9
rtty/files/rtty.config Executable file
View file

@ -0,0 +1,9 @@
config rtty
option interface 'lan'
option id '602302001115'
option description '6018@602302001115'
option host 'routev2.55860.com'
option port '5914'
option token 'daf96d69f52ec4aef2ac6abcf363fc41'
option username 'root'
option verbose '1'

69
rtty/files/rtty.init Executable file
View file

@ -0,0 +1,69 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
BIN=/usr/sbin/rtty
validate_rtty_section() {
uci_load_validate rtty rtty "$1" "$2" \
'interface:uci("network", "@interface"):lan' \
'id:maxlength(63)' \
'description:maxlength(126)' \
'host:host' \
'port:port' \
'ssl:bool:0' \
'insecure:bool:0' \
'token:maxlength(32)' \
'username:string' \
'verbose:bool:0'
}
start_rtty() {
. /lib/functions/network.sh
local ifname
[ "$2" = 0 ] || {
echo "validation failed" >&2
return 1
}
[ -n "$interface" ] && network_get_device ifname "$interface"
[ -z "$ifname" -a -z "$id" ] && {
echo "You must specify an interface or ID" >&2
return 1
}
[ -z "$host" ] && {
echo "host required" >&2
return 1
}
[ -z "$id" ] && {
id=$(sed 's/://g' /sys/class/net/$ifname/address | tr 'a-z' 'A-Z')
}
procd_open_instance
procd_set_param command $BIN -h $host -I "$id" -a
[ -n "$port" ] && procd_append_param command -p "$port"
[ -n "$description" ] && procd_append_param command -d "$description"
[ "$ssl" = "1" ] && procd_append_param command -s
[ "$insecure" = "1" ] && procd_append_param command -x
[ -n "$token" ] && procd_append_param command -t "$token"
[ -n "$username" ] && procd_append_param command -f "$username"
[ "$verbose" = "1" ] && procd_append_param command -v
procd_set_param respawn
procd_close_instance
}
start_service() {
config_load rtty
config_foreach validate_rtty_section rtty start_rtty
}
service_triggers() {
procd_add_reload_trigger "rtty"
procd_add_validation validate_rtty_section
}