update 2026-08-16 16:21:47

This commit is contained in:
action committed 2026-08-16 16:21:47 +08:00
1 parent d298a9b0c2
commit 9f4ff1bb27
21 files changed
+78 -115

No files matched your search

+26 -3
View File
@@ -598,7 +598,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
@@ -671,8 +671,8 @@ function get_node_list()
socks_list = {},
normal_list = {},
}
uci:foreach(c_config, "socks", function(s)
if s.enabled == "1" and s.node then
uci_foreach_c("socks", function(s)
if s.node then
node_list.socks_list[#node_list.socks_list + 1] = {
id = s[".name"],
remark = i18n.translate("Socks Config") .. " [" .. s.port .. i18n.translate("Port") .. "]",
@@ -760,6 +760,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