mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Multiple Shadowsocks-Rust server IP management in wizard
This commit is contained in:
parent
398e81f0fe
commit
f6584db4dc
1 changed files with 33 additions and 3 deletions
|
@ -257,6 +257,11 @@ function wizard_add()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Enable/disable IPv6
|
||||||
|
local disableipv6 = luci.http.formvalue("enableipv6") or "1"
|
||||||
|
ucic:set("openmptcprouter","settings","disable_ipv6",disableipv6)
|
||||||
|
|
||||||
|
|
||||||
-- Set interfaces settings
|
-- Set interfaces settings
|
||||||
local downloadmax = 0
|
local downloadmax = 0
|
||||||
local uploadmax = 0
|
local uploadmax = 0
|
||||||
|
@ -393,6 +398,10 @@ function wizard_add()
|
||||||
ucic:set("network",intf,"ip6addr",ip6addr:gsub("%s+", ""))
|
ucic:set("network",intf,"ip6addr",ip6addr:gsub("%s+", ""))
|
||||||
ucic:set("network",intf,"ip6gw",ip6gw:gsub("%s+", ""))
|
ucic:set("network",intf,"ip6gw",ip6gw:gsub("%s+", ""))
|
||||||
ucic:set("network",intf,"ipv6","1")
|
ucic:set("network",intf,"ipv6","1")
|
||||||
|
elseif proto ~= "static" and proto ~= "dhcp" and disableipv6 ~= "1" then
|
||||||
|
ucic:set("network",intf,"ip6addr","")
|
||||||
|
ucic:set("network",intf,"ip6gw","")
|
||||||
|
ucic:set("network",intf,"ipv6","1")
|
||||||
else
|
else
|
||||||
ucic:set("network",intf,"ip6addr","")
|
ucic:set("network",intf,"ip6addr","")
|
||||||
ucic:set("network",intf,"ip6gw","")
|
ucic:set("network",intf,"ip6gw","")
|
||||||
|
@ -521,9 +530,6 @@ function wizard_add()
|
||||||
ucic:save("network")
|
ucic:save("network")
|
||||||
ucic:commit("network")
|
ucic:commit("network")
|
||||||
|
|
||||||
-- Enable/disable IPv6
|
|
||||||
local disableipv6 = luci.http.formvalue("enableipv6") or "1"
|
|
||||||
ucic:set("openmptcprouter","settings","disable_ipv6",disableipv6)
|
|
||||||
--local ut = require "luci.util"
|
--local ut = require "luci.util"
|
||||||
--local result = ut.ubus("openmptcprouter", "set_ipv6_state", { disable_ipv6 = disableipv6 })
|
--local result = ut.ubus("openmptcprouter", "set_ipv6_state", { disable_ipv6 = disableipv6 })
|
||||||
local ula = luci.http.formvalue("ula") or ""
|
local ula = luci.http.formvalue("ula") or ""
|
||||||
|
@ -759,6 +765,7 @@ function wizard_add()
|
||||||
ucic:set("openmptcprouter","settings","proxy",default_proxy)
|
ucic:set("openmptcprouter","settings","proxy",default_proxy)
|
||||||
ucic:save("openmptcprouter")
|
ucic:save("openmptcprouter")
|
||||||
ucic:save("shadowsocks-libev")
|
ucic:save("shadowsocks-libev")
|
||||||
|
ucic:save("shadowsocks-rust")
|
||||||
ucic:save("v2ray")
|
ucic:save("v2ray")
|
||||||
ucic:save("xray")
|
ucic:save("xray")
|
||||||
|
|
||||||
|
@ -770,6 +777,14 @@ function wizard_add()
|
||||||
ucic:delete("openmptcprouter","omr","ss_" .. sectionname)
|
ucic:delete("openmptcprouter","omr","ss_" .. sectionname)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
ucic:foreach("shadowsocks-rust","server", function(s)
|
||||||
|
local sectionname = s[".name"]
|
||||||
|
if sectionname:match("^sss.*") then
|
||||||
|
ucic:delete("shadowsocks-rust",sectionname,"ip")
|
||||||
|
ucic:set("shadowsocks-rust",sectionname,"disabled","1")
|
||||||
|
ucic:delete("openmptcprouter","omr","ss_" .. sectionname)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
local ss_servers_nginx = {}
|
local ss_servers_nginx = {}
|
||||||
local ss_servers_ha = {}
|
local ss_servers_ha = {}
|
||||||
|
@ -818,15 +833,21 @@ function wizard_add()
|
||||||
if default_proxy == "shadowsocks" and serversnb > disablednb and ssip ~= "" then
|
if default_proxy == "shadowsocks" and serversnb > disablednb and ssip ~= "" then
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
||||||
end
|
end
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"server",ssip)
|
||||||
|
if default_proxy == "shadowsocks-rust" and serversnb > disablednb and ssip ~= "" then
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"disabled","0")
|
||||||
|
end
|
||||||
nbip = nbip + 1
|
nbip = nbip + 1
|
||||||
if disableipv6 == "1" and nbip > 0 then
|
if disableipv6 == "1" and nbip > 0 then
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"disabled","1")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if nbip == 1 then
|
if nbip == 1 then
|
||||||
--ucic:set("shadowsocks-libev","sss" .. nbip,"server",server_ip)
|
--ucic:set("shadowsocks-libev","sss" .. nbip,"server",server_ip)
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"disabled","1")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
k = k + 1
|
k = k + 1
|
||||||
|
@ -864,6 +885,10 @@ function wizard_add()
|
||||||
if default_proxy == "shadowsocks" and serversnb > disablednb and ssip ~= "" then
|
if default_proxy == "shadowsocks" and serversnb > disablednb and ssip ~= "" then
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","0")
|
||||||
end
|
end
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"server",ssip)
|
||||||
|
if default_proxy == "shadowsocks-rust" and serversnb > disablednb and ssip ~= "" then
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"disabled","0")
|
||||||
|
end
|
||||||
nbip = nbip + 1
|
nbip = nbip + 1
|
||||||
if disableipv6 == "1" and nbip > 0 then
|
if disableipv6 == "1" and nbip > 0 then
|
||||||
break
|
break
|
||||||
|
@ -872,6 +897,7 @@ function wizard_add()
|
||||||
if nbip == 1 then
|
if nbip == 1 then
|
||||||
-- ucic:set("shadowsocks-libev","sss" .. nbip,"server",server_ip)
|
-- ucic:set("shadowsocks-libev","sss" .. nbip,"server",server_ip)
|
||||||
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
ucic:set("shadowsocks-libev","sss" .. nbip,"disabled","1")
|
||||||
|
ucic:set("shadowsocks-rust","sss" .. nbip,"disabled","1")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -894,6 +920,7 @@ function wizard_add()
|
||||||
ucic:save("glorytun-udp")
|
ucic:save("glorytun-udp")
|
||||||
--ucic:commit("glorytun")
|
--ucic:commit("glorytun")
|
||||||
ucic:save("shadowsocks-libev")
|
ucic:save("shadowsocks-libev")
|
||||||
|
ucic:save("shadowsocks-rust")
|
||||||
--ucic:commit("shadowsocks-libev")
|
--ucic:commit("shadowsocks-libev")
|
||||||
|
|
||||||
|
|
||||||
|
@ -1059,6 +1086,8 @@ function wizard_add()
|
||||||
ucic:commit("xray")
|
ucic:commit("xray")
|
||||||
ucic:save("shadowsocks-libev")
|
ucic:save("shadowsocks-libev")
|
||||||
ucic:commit("shadowsocks-libev")
|
ucic:commit("shadowsocks-libev")
|
||||||
|
ucic:save("shadowsocks-rust")
|
||||||
|
ucic:commit("shadowsocks-rust")
|
||||||
|
|
||||||
|
|
||||||
-- Set Glorytun settings
|
-- Set Glorytun settings
|
||||||
|
@ -1218,6 +1247,7 @@ function wizard_add()
|
||||||
-- luci.sys.call("sleep 2")
|
-- luci.sys.call("sleep 2")
|
||||||
--end
|
--end
|
||||||
luci.sys.call("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
|
luci.sys.call("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
|
||||||
|
luci.sys.call("/etc/init.d/shadowsocks-rust restart >/dev/null 2>/dev/null")
|
||||||
luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
|
luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
|
||||||
luci.sys.call("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
|
luci.sys.call("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
|
||||||
luci.sys.call("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
|
luci.sys.call("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue