更新屎山
This commit is contained in:
parent
0576ad1827
commit
4fe412086d
@ -32,14 +32,100 @@ append_options() {
|
||||
for o in "$@" ; do
|
||||
v="$(eval echo "\$$o")"
|
||||
if [ -n "$v" ] ; then
|
||||
# add brackets when ipv6 address
|
||||
# IPv6地址处理
|
||||
if ( echo "$o" | grep -qE 'addr|ip' ) &&
|
||||
( echo "$v" | grep -q ':' ) ; then
|
||||
v="[$v]"
|
||||
fi
|
||||
case ${o} in
|
||||
"bind_addr")
|
||||
$o="bindAddr"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"bind_port")
|
||||
$o="bindPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"auth_token")
|
||||
$o="auth.token"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"tls_force")
|
||||
$o="tls.force"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"kcp_bind_port")
|
||||
$o="kcpBindPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"quic_bind_port")
|
||||
$o="quicBindPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"vhost_http_port")
|
||||
$o="vhostHTTPPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"vhost_https_port")
|
||||
$o="vhostHTTPSPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"tcpmux_http_connect_port")
|
||||
$o="tcpmuxHTTPConnectPort"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"transport_max_pool_count")
|
||||
$o="transport.maxPoolCount"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"max_ports_per_client")
|
||||
$o="maxPortsPerClient"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"enable_prometheus")
|
||||
$o="enablePrometheus"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"webserver_addr")
|
||||
$o="webServer.addr"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"webserver_port")
|
||||
$o="webServer.port"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"webserver_user")
|
||||
$o="webServer.user"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"webserver_password")
|
||||
$o="webServer.password"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"sub_domain_host")
|
||||
$o="subDomainHost"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"log_to")
|
||||
$o="log.to"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"log_level")
|
||||
$o="log.level"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"log_maxdays")
|
||||
$o="log.maxDays"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
"log_disable_print_color")
|
||||
$o="log.disablePrintColor"
|
||||
echo "${o} = $v" >>"$file"
|
||||
;;
|
||||
*) echo "${o} = $v" >>"$file"
|
||||
esac
|
||||
|
||||
echo "${o} = $v" >>"$file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -97,11 +183,9 @@ add_rule_extra_option() {
|
||||
create_config_file() {
|
||||
local config_file="$1"
|
||||
local tmp_file="$(mktemp /tmp/frps-XXXXXX)"
|
||||
|
||||
echo "[common]" > "$tmp_file"
|
||||
|
||||
append_options "$tmp_file" \
|
||||
"bind_port" "token" "tcp_mux" "tls_only" "bind_udp_port" "kcp_bind_port" "quic_bind_port" "vhost_http_port" "vhost_https_port"
|
||||
"bind_addr" "bind_port" "auth_token" "tls_force" "kcp_bind_port" "quic_bind_port" "vhost_http_port" "vhost_https_port" "tcpmux_http_connect_port"
|
||||
|
||||
|
||||
if [ "x$enable_logging" = "x1" ] ; then
|
||||
@ -110,7 +194,7 @@ create_config_file() {
|
||||
fi
|
||||
|
||||
append_options "$tmp_file" \
|
||||
"log_file" "log_level" "log_max_days" "disable_log_color"
|
||||
"log_to" "log_level" "log_maxdays" "log_disable_print_color"
|
||||
|
||||
if [ -f "$log_file" ] ; then
|
||||
echo > "$log_file"
|
||||
@ -131,7 +215,7 @@ create_config_file() {
|
||||
fi
|
||||
|
||||
append_options "$tmp_file" \
|
||||
"max_pool_count" "max_ports_per_client" "subdomain_host" "dashboard_addr" "dashboard_port" "dashboard_user" "dashboard_pwd"
|
||||
"transport_max_pool_count" "max_ports_per_client" "enable_prometheus" "sub_domain_host" "webserver_addr" "webserver_port" "webserver_user" "webserver_password"
|
||||
|
||||
extra_setting=$(uci get frps.main.extra_setting 2>/dev/null)
|
||||
if [ -n "$extra_setting" ] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user