luci-app-ssr-plus: allow run socks5 server independently

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Mattraks 2021-04-23 09:47:20 +08:00 committed by Tianling Shen
parent 6c33a084b9
commit 17fdfe2ad8
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 8 additions and 3 deletions

View File

@ -3,9 +3,9 @@ local server_table = {}
uci:foreach("shadowsocksr", "servers", function(s)
if s.alias then
server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.type), s.alias}
server_table[s[".name"]] = "[%s]:%s" % {string.upper(s.v2ray_protocol or s.type), s.alias}
elseif s.server and s.server_port then
server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.type), s.server, s.server_port}
server_table[s[".name"]] = "[%s]:%s:%s" % {string.upper(s.v2ray_protocol or s.type), s.server, s.server_port}
end
end)

View File

@ -461,6 +461,7 @@ start_shunt() {
}
start_local() {
[ "$LOCAL_SERVER" = "nil" ] && return 1
local local_port=$(uci_get_by_type socks5_proxy local_port)
[ "$LOCAL_SERVER" == "$SHUNT_SERVER" ] && tmp_local_port=$local_port
local type=$(uci_get_by_name $LOCAL_SERVER type)
@ -580,12 +581,16 @@ load_config() {
else
GLOBAL_SERVER=$switch_server
fi
LOCAL_SERVER=$(uci_get_by_type socks5_proxy server nil)
if [ "$GLOBAL_SERVER" == "nil" ]; then
mode="tcp,udp"
_local="2"
local_config_file=$TMP_PATH/tcp-udp-ssr-local.json
start_local
return 1
fi
UDP_RELAY_SERVER=$(uci_get_by_type global udp_relay_server nil)
SHUNT_SERVER=$(uci_get_by_type global netflix_server nil)
LOCAL_SERVER=$(uci_get_by_type socks5_proxy server nil)
tcp_config_file=$TMP_PATH/tcp-only-ssr-retcp.json
case "$UDP_RELAY_SERVER" in
nil)