frpc: add anonymous proxy config support

Signed-off-by: Van Waholtz <vanwaholtz@gmail.com>
This commit is contained in:
Van Waholtz 2022-01-29 09:39:33 +08:00 committed by Rosen Penev
parent 0238bcef19
commit 30d8431b71
3 changed files with 27 additions and 1 deletions

View File

@ -33,6 +33,11 @@ define Package/frp/install
$(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

View File

@ -21,7 +21,9 @@ config_cb() {
option_cb() {
local option="$1"
local value="$2"
echo "$option = $value" >> "$conf_file"
[ "$option" = "name" ] && \
sed -i "s/$CONFIG_SECTION/$value/g" "$conf_file" || \
echo "$option = $value" >> "$conf_file";
}
list_cb() {
local name="$1"

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