mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-19 14:13:30 +00:00
luci ssr plus: add socks5 proxy service
This commit is contained in:
parent
9b3b5c8cce
commit
5225242b8c
@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-ssr-plus
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=49
|
||||
PKG_RELEASE:=50
|
||||
|
||||
PO2LMO:=$(BUILD_DIR)/luci-base/po2lmo
|
||||
|
||||
|
@ -3,9 +3,9 @@ local uci = luci.model.uci.cursor()
|
||||
local server_table = {}
|
||||
|
||||
uci:foreach(shadowsocksr, "servers", function(s)
|
||||
if s.alias then
|
||||
if s.alias and s.type == "ssr" then
|
||||
server_table[s[".name"]] = s.alias
|
||||
elseif s.server and s.server_port then
|
||||
elseif s.server and s.server_port and s.type == "ssr" then
|
||||
server_table[s[".name"]] = "%s:%s" %{s.server, s.server_port}
|
||||
end
|
||||
end)
|
||||
@ -31,4 +31,23 @@ o.default = 5
|
||||
-- o = s:option(Flag, "monitor_enable", translate("Enable Process Deamon"))
|
||||
-- o.rmempty = false
|
||||
|
||||
|
||||
-- [[ SOCKS5 Proxy ]]--
|
||||
if nixio.fs.access("/usr/bin/ssr-local") then
|
||||
s = m:section(TypedSection, "socks5_proxy", translate("SOCKS5 Proxy"))
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, "server", translate("Server"))
|
||||
o:value("nil", translate("Disable"))
|
||||
for k, v in pairs(server_table) do o:value(k, v) end
|
||||
o.default = "nil"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "local_port", translate("Local Port"))
|
||||
o.datatype = "port"
|
||||
o.default = 1080
|
||||
o.rmempty = false
|
||||
|
||||
end
|
||||
|
||||
return m
|
||||
|
@ -70,6 +70,10 @@ if luci.sys.call("ps -w | grep ssr-retcp | grep -v grep >/dev/null") == 0 then
|
||||
redir_run=1
|
||||
end
|
||||
|
||||
if luci.sys.call("pidof ssr-local >/dev/null") == 0 then
|
||||
sock5_run=1
|
||||
end
|
||||
|
||||
if luci.sys.call("pidof ssr-kcptun >/dev/null") == 0 then
|
||||
kcptun_run=1
|
||||
end
|
||||
@ -114,6 +118,16 @@ else
|
||||
s.value = translate("Not Running")
|
||||
end
|
||||
|
||||
if nixio.fs.access("/usr/bin/ssr-local") then
|
||||
s=m:field(DummyValue,"sock5_run",translate("SOCKS5 Proxy"))
|
||||
s.rawhtml = true
|
||||
if sock5_run == 1 then
|
||||
s.value =font_blue .. bold_on .. translate("Running") .. bold_off .. font_off
|
||||
else
|
||||
s.value = translate("Not Running")
|
||||
end
|
||||
end
|
||||
|
||||
if nixio.fs.access("/usr/bin/ssr-server") then
|
||||
s=m:field(DummyValue,"server_run",translate("Global SSR Server"))
|
||||
s.rawhtml = true
|
||||
|
@ -387,7 +387,7 @@ iptables -t filter -I INPUT -j SSR-SERVER-RULE
|
||||
fi
|
||||
|
||||
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
|
||||
/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 udp --dport $(uci_get_by_name $1 server_port) -j ACCEPT
|
||||
return 0
|
||||
@ -430,7 +430,7 @@ start_local() {
|
||||
/usr/bin/ssr-local -c $CONFIG_SOCK5_FILE -u \
|
||||
-l $(uci_get_by_type socks5_proxy local_port 1080) \
|
||||
-b $(uci_get_by_type socks5_proxy local_address 0.0.0.0) \
|
||||
-f /var/run/ssr-local.pid
|
||||
-f /var/run/ssr-local.pid >/dev/null 2>&1
|
||||
local_enable=1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user