From 53fa21f3d6ed530b9fee667f185e6ada881695fa Mon Sep 17 00:00:00 2001 From: lean Date: Mon, 23 Mar 2020 00:39:52 +0800 Subject: [PATCH] luci-app-ssr-plus: fix global socks5 ssr server support --- package/lean/luci-app-ssr-plus/Makefile | 2 +- .../root/etc/init.d/shadowsocksr | 27 ++++++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/package/lean/luci-app-ssr-plus/Makefile b/package/lean/luci-app-ssr-plus/Makefile index 6bf2a65f4..a4ff5e82f 100644 --- a/package/lean/luci-app-ssr-plus/Makefile +++ b/package/lean/luci-app-ssr-plus/Makefile @@ -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) diff --git a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr index 506d4257a..c2d92d63a 100755 --- a/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr +++ b/package/lean/luci-app-ssr-plus/root/etc/init.d/shadowsocksr @@ -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() {