luci-app-ssr-plus: fix global socks5 ssr server support

This commit is contained in:
lean 2020-03-23 00:39:52 +08:00
parent 4ed0db41c4
commit 53fa21f3d6
2 changed files with 9 additions and 20 deletions

View File

@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-ssr-plus
PKG_VERSION:=173
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

View File

@ -574,25 +574,14 @@ start_server() {
}
start_local() {
local local_server=$(uci_get_by_type socks5_proxy socks 0)
[ "$local_server" == "0" ] && return 0
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 0)
local socks_port=$(uci_get_by_type socks5_proxy local_port 1080)
if [ "$auth_enable" == "1" ]; then
microsocks -i :: -p $socks_port -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) ssr-socks >/dev/null 2>&1 &
else
microsocks -i :: -p $socks_port ssr-socks >/dev/null 2>&1 &
fi
local_enable=1
if [ "$(uci_get_by_type socks5_proxy wan_enable 0)" == "1" ]; then
if ! (iptables-save -t filter | grep SSR-SERVER-RULE >/dev/null); then
iptables -N SSR-SERVER-RULE && \
iptables -t filter -I INPUT -j SSR-SERVER-RULE
fi
iptables -t filter -A SSR-SERVER-RULE -p tcp --dport $socks_port -j ACCEPT
iptables -t filter -A SSR-SERVER-RULE -p udp --dport $socks_port -j ACCEPT
gen_serv_include
fi
local local_server=$(uci_get_by_type socks5_proxy server)
[ "$local_server" = "nil" ] && return 1
local local_type=$(uci_get_by_name $local_server type)
mkdir -p /var/run /var/etc
gen_config_file $local_server 3 $(uci_get_by_type socks5_proxy local_port 1080)
/usr/bin/ssr-local -c $CONFIG_SOCK5_FILE -u \
-f /var/run/ssr-local.pid >/dev/null 2>&1
local_enable=1
}
rules() {