parent
f342dc5cb7
commit
aae65ba114
@ -146,6 +146,11 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
|||||||
m:set(shunt_node_id, option, value)
|
m:set(shunt_node_id, option, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function get_remove(shunt_node_id, option)
|
||||||
|
return function(self, section)
|
||||||
|
m:del(shunt_node_id, option)
|
||||||
|
end
|
||||||
|
end
|
||||||
if #normal_list > 0 then
|
if #normal_list > 0 then
|
||||||
for k, v in pairs(shunt_list) do
|
for k, v in pairs(shunt_list) do
|
||||||
local vid = v.id
|
local vid = v.id
|
||||||
@ -197,6 +202,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
|||||||
o = s:taboption("Main", ListValue, node_option, string.format('* <a href="%s" target="_blank">%s</a>', api.url("shunt_rules", id), e.remarks))
|
o = s:taboption("Main", ListValue, node_option, string.format('* <a href="%s" target="_blank">%s</a>', api.url("shunt_rules", id), e.remarks))
|
||||||
o.cfgvalue = get_cfgvalue(v.id, id)
|
o.cfgvalue = get_cfgvalue(v.id, id)
|
||||||
o.write = get_write(v.id, id)
|
o.write = get_write(v.id, id)
|
||||||
|
o.remove = get_remove(v.id, id)
|
||||||
o:depends("tcp_node", v.id)
|
o:depends("tcp_node", v.id)
|
||||||
o:value("", translate("Close"))
|
o:value("", translate("Close"))
|
||||||
o:value("_default", translate("Default"))
|
o:value("_default", translate("Default"))
|
||||||
@ -206,6 +212,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
|||||||
local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* <a style="color:red">%s</a>', e.remarks .. " " .. translate("Preproxy")))
|
local pt = s:taboption("Main", ListValue, vid .. "-".. id .. "_proxy_tag", string.format('* <a style="color:red">%s</a>', e.remarks .. " " .. translate("Preproxy")))
|
||||||
pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag")
|
pt.cfgvalue = get_cfgvalue(v.id, id .. "_proxy_tag")
|
||||||
pt.write = get_write(v.id, id .. "_proxy_tag")
|
pt.write = get_write(v.id, id .. "_proxy_tag")
|
||||||
|
pt.remove = get_remove(v.id, id .. "_proxy_tag")
|
||||||
pt:value("", translate("Close"))
|
pt:value("", translate("Close"))
|
||||||
pt:value("main", translate("Preproxy Node"))
|
pt:value("main", translate("Preproxy Node"))
|
||||||
for k1, v1 in pairs(socks_list) do
|
for k1, v1 in pairs(socks_list) do
|
||||||
@ -228,6 +235,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
|||||||
o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* <a style="color:red">%s</a>', translate("Default")))
|
o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* <a style="color:red">%s</a>', translate("Default")))
|
||||||
o.cfgvalue = get_cfgvalue(v.id, id)
|
o.cfgvalue = get_cfgvalue(v.id, id)
|
||||||
o.write = get_write(v.id, id)
|
o.write = get_write(v.id, id)
|
||||||
|
o.remove = get_remove(v.id, id)
|
||||||
o:depends("tcp_node", v.id)
|
o:depends("tcp_node", v.id)
|
||||||
o:value("_direct", translate("Direct Connection"))
|
o:value("_direct", translate("Direct Connection"))
|
||||||
o:value("_blackhole", translate("Blackhole"))
|
o:value("_blackhole", translate("Blackhole"))
|
||||||
@ -248,6 +256,7 @@ if (has_singbox or has_xray) and #nodes_table > 0 then
|
|||||||
o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* <a style="color:red">%s</a>', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node."))
|
o = s:taboption("Main", ListValue, vid .. "-" .. id, string.format('* <a style="color:red">%s</a>', translate("Default Preproxy")), translate("When using, localhost will connect this node first and then use this node to connect the default node."))
|
||||||
o.cfgvalue = get_cfgvalue(v.id, id)
|
o.cfgvalue = get_cfgvalue(v.id, id)
|
||||||
o.write = get_write(v.id, id)
|
o.write = get_write(v.id, id)
|
||||||
|
o.remove = get_remove(v.id, id)
|
||||||
o:value("", translate("Close"))
|
o:value("", translate("Close"))
|
||||||
o:value("main", translate("Preproxy Node"))
|
o:value("main", translate("Preproxy Node"))
|
||||||
for k1, v1 in pairs(normal_list) do
|
for k1, v1 in pairs(normal_list) do
|
||||||
|
@ -959,7 +959,7 @@ function gen_config(var)
|
|||||||
rule_outboundTag = "block"
|
rule_outboundTag = "block"
|
||||||
elseif _node_id == "_default" and rule_name ~= "default" then
|
elseif _node_id == "_default" and rule_name ~= "default" then
|
||||||
rule_outboundTag = "default"
|
rule_outboundTag = "default"
|
||||||
elseif _node_id:find("Socks_") then
|
elseif _node_id and _node_id:find("Socks_") then
|
||||||
local socks_id = _node_id:sub(1 + #"Socks_")
|
local socks_id = _node_id:sub(1 + #"Socks_")
|
||||||
local socks_node = uci:get_all(appname, socks_id) or nil
|
local socks_node = uci:get_all(appname, socks_id) or nil
|
||||||
if socks_node then
|
if socks_node then
|
||||||
|
@ -846,7 +846,7 @@ function gen_config(var)
|
|||||||
return "blackhole", nil
|
return "blackhole", nil
|
||||||
elseif _node_id == "_default" then
|
elseif _node_id == "_default" then
|
||||||
return "default", nil
|
return "default", nil
|
||||||
elseif _node_id:find("Socks_") then
|
elseif _node_id and _node_id:find("Socks_") then
|
||||||
local socks_id = _node_id:sub(1 + #"Socks_")
|
local socks_id = _node_id:sub(1 + #"Socks_")
|
||||||
local socks_node = uci:get_all(appname, socks_id) or nil
|
local socks_node = uci:get_all(appname, socks_id) or nil
|
||||||
local socks_tag
|
local socks_tag
|
||||||
|
@ -119,7 +119,6 @@ end
|
|||||||
|
|
||||||
function copy_instance(var)
|
function copy_instance(var)
|
||||||
local LISTEN_PORT = var["-LISTEN_PORT"]
|
local LISTEN_PORT = var["-LISTEN_PORT"]
|
||||||
local DNSMASQ_CONF = var["-DNSMASQ_CONF"]
|
|
||||||
local conf_lines = {}
|
local conf_lines = {}
|
||||||
local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')")
|
local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')")
|
||||||
for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do
|
for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do
|
||||||
@ -135,7 +134,11 @@ function copy_instance(var)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
tinsert(conf_lines, "port=" .. LISTEN_PORT)
|
tinsert(conf_lines, "port=" .. LISTEN_PORT)
|
||||||
|
if var["-return_table"] == "1" then
|
||||||
|
return conf_lines
|
||||||
|
end
|
||||||
if #conf_lines > 0 then
|
if #conf_lines > 0 then
|
||||||
|
local DNSMASQ_CONF = var["-DNSMASQ_CONF"]
|
||||||
local conf_out = io.open(DNSMASQ_CONF, "a")
|
local conf_out = io.open(DNSMASQ_CONF, "a")
|
||||||
conf_out:write(table.concat(conf_lines, "\n"))
|
conf_out:write(table.concat(conf_lines, "\n"))
|
||||||
conf_out:close()
|
conf_out:close()
|
||||||
@ -616,20 +619,7 @@ function add_rule(var)
|
|||||||
local conf_lines = {}
|
local conf_lines = {}
|
||||||
if LISTEN_PORT then
|
if LISTEN_PORT then
|
||||||
--Copy dnsmasq instance
|
--Copy dnsmasq instance
|
||||||
local DEFAULT_DNSMASQ_CFGID = sys.exec("echo -n $(uci -q show dhcp.@dnsmasq[0] | awk 'NR==1 {split($0, conf, /[.=]/); print conf[2]}')")
|
conf_lines = copy_instance({["-LISTEN_PORT"] = LISTEN_PORT, ["-return_table"] = "1"})
|
||||||
for line in io.lines("/tmp/etc/dnsmasq.conf." .. DEFAULT_DNSMASQ_CFGID) do
|
|
||||||
local filter
|
|
||||||
if line:find("passwall") then filter = true end
|
|
||||||
if line:find("ubus") then filter = true end
|
|
||||||
if line:find("dhcp") then filter = true end
|
|
||||||
if line:find("server=") == 1 then filter = true end
|
|
||||||
if line:find("port=") == 1 then filter = true end
|
|
||||||
if line:find("address=") == 1 or (line:find("server=") == 1 and line:find("/")) then filter = nil end
|
|
||||||
if not filter then
|
|
||||||
tinsert(conf_lines, line)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
tinsert(conf_lines, "port=" .. LISTEN_PORT)
|
|
||||||
else
|
else
|
||||||
--Modify the default dnsmasq service
|
--Modify the default dnsmasq service
|
||||||
end
|
end
|
||||||
|
@ -33,10 +33,10 @@ index 6851861..669a612 100644
|
|||||||
if code ~= 0 then
|
if code ~= 0 then
|
||||||
local use_time = luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $2}'")
|
local use_time = luci.sys.exec("echo -n '" .. result .. "' | awk -F ':' '{print $2}'")
|
||||||
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
index 7ea652a..2b4c853 100644
|
index 958ff0a..23b8a29 100644
|
||||||
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
--- a/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
+++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua
|
||||||
@@ -465,6 +465,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9)")
|
@@ -474,6 +474,12 @@ o:value("9.9.9.9", "9.9.9.9 (Quad9)")
|
||||||
o:value("149.112.112.112", "149.112.112.112 (Quad9)")
|
o:value("149.112.112.112", "149.112.112.112 (Quad9)")
|
||||||
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
o:value("208.67.220.220", "208.67.220.220 (OpenDNS)")
|
||||||
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
o:value("208.67.222.222", "208.67.222.222 (OpenDNS)")
|
||||||
|
Loading…
Reference in New Issue
Block a user