mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-14 20:06:59 +08:00
luci-app-ssr-plus: can enable socks5 access for wan (option)
This commit is contained in:
parent
15e72a7500
commit
b348f904bf
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
|
|
||||||
PKG_NAME:=luci-app-ssr-plus
|
PKG_NAME:=luci-app-ssr-plus
|
||||||
PKG_VERSION:=162
|
PKG_VERSION:=162
|
||||||
PKG_RELEASE:=5
|
PKG_RELEASE:=7
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ o.rmempty = false
|
|||||||
|
|
||||||
o = s:option(Value, "local_port", translate("Local Port"))
|
o = s:option(Value, "local_port", translate("Local Port"))
|
||||||
o.datatype = "port"
|
o.datatype = "port"
|
||||||
o.default = 1080
|
o.default = 10800
|
||||||
o.rmempty = true
|
o.rmempty = true
|
||||||
o:depends("socks", "1")
|
o:depends("socks", "1")
|
||||||
|
|
||||||
@ -62,12 +62,17 @@ o.default = "0"
|
|||||||
o:depends("socks", "1")
|
o:depends("socks", "1")
|
||||||
|
|
||||||
o = s:option(Value, "username", translate("Username"))
|
o = s:option(Value, "username", translate("Username"))
|
||||||
o.rmempty = true
|
o.default = "username"
|
||||||
o:depends("auth_enable", "1")
|
o:depends("auth_enable", "1")
|
||||||
|
|
||||||
o = s:option(Value, "password", translate("Password"))
|
o = s:option(Value, "password", translate("Password"))
|
||||||
o.password = true
|
o.password = true
|
||||||
|
o.default = "password"
|
||||||
|
o:depends("auth_enable", "1")
|
||||||
|
|
||||||
|
o = s:option(Flag, "wan_enable", translate("Enable WAN Access"))
|
||||||
o.rmempty = true
|
o.rmempty = true
|
||||||
|
o.default = "0"
|
||||||
o:depends("auth_enable", "1")
|
o:depends("auth_enable", "1")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -626,10 +626,13 @@ msgid "Enable SOCKS5 Proxy Server"
|
|||||||
msgstr "启用 SOCKS5 代理服务"
|
msgstr "启用 SOCKS5 代理服务"
|
||||||
|
|
||||||
msgid "Enable Authentication"
|
msgid "Enable Authentication"
|
||||||
msgstr "启用 用户名/密码 认证"
|
msgstr "启用用户名/密码认证"
|
||||||
|
|
||||||
msgid "SOCKS5 Proxy Server"
|
msgid "Enable SOCKS5 Proxy Server"
|
||||||
msgstr "SOCKS5 代理服务端"
|
msgstr "启用 SOCKS5 代理服务"
|
||||||
|
|
||||||
|
msgid "Enable WAN Access"
|
||||||
|
msgstr "允许从 WAN 访问"
|
||||||
|
|
||||||
msgid "Redirect traffic to this network interface"
|
msgid "Redirect traffic to this network interface"
|
||||||
msgstr "分流到这个网络接口"
|
msgstr "分流到这个网络接口"
|
||||||
|
@ -431,9 +431,11 @@ start_service() {
|
|||||||
[ $(uci_get_by_name $1 enable 0) == "0" ] && return 1
|
[ $(uci_get_by_name $1 enable 0) == "0" ] && return 1
|
||||||
let server_count=server_count+1
|
let server_count=server_count+1
|
||||||
if [ "$server_count" == "1" ]; then
|
if [ "$server_count" == "1" ]; then
|
||||||
|
if ! (iptables-save -t filter | grep SSR-SERVER-RULE >/dev/null); then
|
||||||
iptables -N SSR-SERVER-RULE && \
|
iptables -N SSR-SERVER-RULE && \
|
||||||
iptables -t filter -I INPUT -j SSR-SERVER-RULE
|
iptables -t filter -I INPUT -j SSR-SERVER-RULE
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
gen_service_file $1 /var/etc/${NAME}_$server_count.json
|
gen_service_file $1 /var/etc/${NAME}_$server_count.json
|
||||||
/usr/bin/ssr-server -c /var/etc/${NAME}_$server_count.json -u -f /var/run/ssr-server$server_count.pid >/dev/null 2>&1
|
/usr/bin/ssr-server -c /var/etc/${NAME}_$server_count.json -u -f /var/run/ssr-server$server_count.pid >/dev/null 2>&1
|
||||||
iptables -t filter -A SSR-SERVER-RULE -p tcp --dport $(uci_get_by_name $1 server_port) -j ACCEPT
|
iptables -t filter -A SSR-SERVER-RULE -p tcp --dport $(uci_get_by_name $1 server_port) -j ACCEPT
|
||||||
@ -474,12 +476,22 @@ start_local() {
|
|||||||
local local_server=$(uci_get_by_type socks5_proxy socks 0)
|
local local_server=$(uci_get_by_type socks5_proxy socks 0)
|
||||||
[ "$local_server" == "0" ] && return 0
|
[ "$local_server" == "0" ] && return 0
|
||||||
local auth_enable=$(uci_get_by_type socks5_proxy auth_enable 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
|
if [ "$auth_enable" == "1" ]; then
|
||||||
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) -1 -u $(uci_get_by_type socks5_proxy username) -P $(uci_get_by_type socks5_proxy password) ssr-socks >/dev/null 2>&1 &
|
microsocks -i 0.0.0.0 -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
|
else
|
||||||
microsocks -i 0.0.0.0 -p $(uci_get_by_type socks5_proxy local_port 1080) ssr-socks >/dev/null 2>&1 &
|
microsocks -i 0.0.0.0 -p $socks_port ssr-socks >/dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
local_enable=1
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
rules() {
|
rules() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user