update 2026-08-17 08:56:27

This commit is contained in:
action committed 2026-08-17 08:56:27 +08:00
1 parent a410b26046
commit e12e831d01
8 files changed
+48 -105

No files matched your search

+25 -2
View File
@@ -565,7 +565,7 @@ function get_valid_nodes()
local nodes = {}
local default_nodes = {}
local other_nodes = {}
uci:foreach(c_config, "nodes", function(e)
uci_foreach_c("nodes", function(e)
e.id = e[".name"]
if e.type and e.remarks then
local type_name = e.type
@@ -638,7 +638,7 @@ function get_node_list()
socks_list = {},
normal_list = {},
}
uci:foreach(c_config, "socks", function(s)
uci_foreach_c("socks", function(s)
if s.enabled == "1" and s.node then
node_list.socks_list[#node_list.socks_list + 1] = {
id = s[".name"],
@@ -727,6 +727,29 @@ function get_full_node_remarks(n)
return remarks
end
function get_random_normal_node(exclude_id)
local exclude_id_lookup = {}
if type(exclude_id) == "table" then
for i, v in ipairs(exclude_id) do
exclude_id_lookup[v] = true
end
elseif type(exclude_id) == "string" then
exclude_id_lookup[exclude_id] = true
end
local normal_list = {}
for k, e in ipairs(get_valid_nodes()) do
if e.node_type == "normal" and not exclude_id_lookup[e[".name"]] then
normal_list[#normal_list + 1] = e
end
end
if #normal_list > 0 then
math.randomseed(os.time())
local num = math.random(1, #normal_list)
return normal_list[num]
end
return nil
end
function gen_uuid()
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
return uuid