mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-07 04:34:14 +08:00
update 2026-08-09 04:21:56
This commit is contained in:
1 parent
62707c2029
commit
2ead6d3cf2
1994 files changed
+1524120
-950
No files matched your search
@@ -180,10 +180,10 @@ do
|
||||
local flag = "Socks节点列表[" .. i .. "]备用节点的列表"
|
||||
local currentNodes = {}
|
||||
local newNodes = {}
|
||||
for k, node_id in ipairs(t.autoswitch_backup_node) do
|
||||
if node_id then
|
||||
local currentNode = uci:get_all(appname, node_id) or nil
|
||||
if currentNode then
|
||||
for k, asb_node in ipairs(t.autoswitch_backup_node) do
|
||||
if asb_node then
|
||||
local currentNode = uci:get_all(appname, asb_node) or {}
|
||||
if currentNode[".type"] == "nodes" then
|
||||
currentNodes[#currentNodes + 1] = {
|
||||
log = true,
|
||||
remarks = flag .. "[" .. k .. "]",
|
||||
@@ -291,17 +291,20 @@ do
|
||||
|
||||
for k, e in pairs(rules) do
|
||||
local _node_id = node[e[".name"]] or nil
|
||||
if _node_id and not _node_id:find("Socks_") then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = false,
|
||||
currentNode = _node_id and uci:get_all(appname, _node_id) or nil,
|
||||
remarks = "分流" .. e.remarks .. "节点",
|
||||
set = function(o, server)
|
||||
if not server then server = "" end
|
||||
uci:set(appname, node_id, e[".name"], server)
|
||||
o.newNodeId = server
|
||||
end
|
||||
}
|
||||
if _node_id then
|
||||
local section = uci:get_all(appname, _node_id) or {}
|
||||
if section[".type"] == "nodes" then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = false,
|
||||
currentNode = section,
|
||||
remarks = "分流" .. e.remarks .. "节点",
|
||||
set = function(o, server)
|
||||
if not server then server = "" end
|
||||
uci:set(appname, node_id, e[".name"], server)
|
||||
o.newNodeId = server
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif node.protocol and node.protocol == '_balancing' then
|
||||
@@ -309,17 +312,18 @@ do
|
||||
local currentNodes = {}
|
||||
local newNodes = {}
|
||||
if node.balancing_node then
|
||||
for k, node in pairs(node.balancing_node) do
|
||||
for k, b_node_id in pairs(node.balancing_node) do
|
||||
currentNodes[#currentNodes + 1] = {
|
||||
log = true,
|
||||
node = node,
|
||||
node = b_node_id,
|
||||
currentNode = (function()
|
||||
if node and node:find("Socks_") then
|
||||
return { Socks = node }
|
||||
local section = uci:get_all(appname, b_node_id) or {}
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = b_node_id }
|
||||
end
|
||||
return node and uci:get_all(appname, node) or nil
|
||||
return section
|
||||
end)(),
|
||||
remarks = node,
|
||||
remarks = b_node_id,
|
||||
set = function(o, server)
|
||||
if o and server and server ~= "nil" then
|
||||
table.insert(o.newNodes, server)
|
||||
@@ -342,37 +346,41 @@ do
|
||||
|
||||
--后备节点
|
||||
local currentNode = uci:get_all(appname, node_id) or nil
|
||||
if currentNode and currentNode.fallback_node and not currentNode.fallback_node:find("Socks_") then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "Xray负载均衡节点[" .. node_id .. "]后备节点",
|
||||
currentNode = uci:get_all(appname, currentNode.fallback_node) or nil,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "fallback_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "fallback_node")
|
||||
end
|
||||
}
|
||||
if currentNode and currentNode.fallback_node then
|
||||
local section = uci:get_all(appname, currentNode.fallback_node) or {}
|
||||
if section[".type"] == "nodes" then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "Xray负载均衡节点[" .. node_id .. "]后备节点",
|
||||
currentNode = section,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "fallback_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "fallback_node")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
elseif node.protocol and node.protocol == '_urltest' then
|
||||
local flag = "Sing-Box URLTest节点[" .. node_id .. "]列表"
|
||||
local currentNodes = {}
|
||||
local newNodes = {}
|
||||
if node.urltest_node then
|
||||
for k, node in pairs(node.urltest_node) do
|
||||
for k, u_node_id in pairs(node.urltest_node) do
|
||||
currentNodes[#currentNodes + 1] = {
|
||||
log = true,
|
||||
node = node,
|
||||
node = u_node_id,
|
||||
currentNode = (function()
|
||||
if node and node:find("Socks_") then
|
||||
return { Socks = node }
|
||||
local section = uci:get_all(appname, u_node_id) or {}
|
||||
if section[".type"] == "socks" then
|
||||
return { Socks = u_node_id }
|
||||
end
|
||||
return node and uci:get_all(appname, node) or nil
|
||||
return section
|
||||
end)(),
|
||||
remarks = node,
|
||||
remarks = u_node_id,
|
||||
set = function(o, server)
|
||||
if o and server and server ~= "nil" then
|
||||
table.insert(o.newNodes, server)
|
||||
@@ -395,37 +403,43 @@ do
|
||||
else
|
||||
--前置代理节点
|
||||
local currentNode = uci:get_all(appname, node_id) or nil
|
||||
if currentNode and currentNode.preproxy_node and not currentNode.preproxy_node:find("Socks_") then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "节点[" .. node_id .. "]前置代理节点",
|
||||
currentNode = uci:get_all(appname, currentNode.preproxy_node) or nil,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "preproxy_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "preproxy_node")
|
||||
end
|
||||
}
|
||||
if currentNode and currentNode.preproxy_node then
|
||||
local section = uci:get_all(appname, currentNode.preproxy_node) or {}
|
||||
if section[".type"] == "nodes" then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "节点[" .. node_id .. "]前置代理节点",
|
||||
currentNode = uci:get_all(appname, currentNode.preproxy_node) or nil,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "preproxy_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "preproxy_node")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
--落地节点
|
||||
local currentNode = uci:get_all(appname, node_id) or nil
|
||||
if currentNode and currentNode.to_node and not currentNode.to_node:find("Socks_") then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "节点[" .. node_id .. "]落地节点",
|
||||
currentNode = uci:get_all(appname, currentNode.to_node) or nil,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "to_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "to_node")
|
||||
end
|
||||
}
|
||||
if currentNode and currentNode.to_node then
|
||||
local section = uci:get_all(appname, currentNode.to_node) or {}
|
||||
if section[".type"] == "nodes" then
|
||||
CONFIG[#CONFIG + 1] = {
|
||||
log = true,
|
||||
id = node_id,
|
||||
remarks = "节点[" .. node_id .. "]落地节点",
|
||||
currentNode = uci:get_all(appname, currentNode.to_node) or nil,
|
||||
set = function(o, server)
|
||||
uci:set(appname, node_id, "to_node", server)
|
||||
o.newNodeId = server
|
||||
end,
|
||||
delete = function(o)
|
||||
uci:delete(appname, node_id, "to_node")
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in new issue
Block a user