update 2026-10-01 07:23:35

This commit is contained in:
action committed 2026-10-01 07:23:35 +08:00
1 parent 4596096d87
commit a1a00fc6d1
33 files changed
+81 -1298

No files matched your search

@@ -24,10 +24,10 @@ local fs = api.fs
local datatypes = api.datatypes
local TMP_PATH = api.TMP_PATH
local TMP_ACL_PATH = TMP_PATH .. "/acl"
local RULES_PATH = "/usr/share/passwall/rules"
local USER_RULES_PATH = "/etc/passwall/rules"
local FLAG_PATH = TMP_ACL_PATH .. "/" .. FLAG
local CACHE_RULES_PATH = api.CACHE_PATH .. "/user_rules"
local FLAG_PATH = TMP_PATH .. "/acl/" .. FLAG
local config_lines = {}
local tmp_lines = {}
local USE_GEOVIEW = api.uci_get_c("@global_rules[0]", "enable_geoview")
@@ -104,9 +104,8 @@ local function get_geosite(list_arg, out_path)
return 1
end
if not fs.access(FLAG_PATH) then
fs.mkdir(FLAG_PATH)
end
sys.call("mkdir -p %s" % FLAG_PATH)
sys.call("mkdir -p %s" % CACHE_RULES_PATH)
local setflag = (NFTFLAG == "1") and "inet@passwall@" or ""
@@ -127,7 +126,7 @@ end
--自定义规则组,后声明的组具有更高优先级
--屏蔽列表
local file_block_host = TMP_ACL_PATH .. "/block_host"
local file_block_host = CACHE_RULES_PATH .. "/block_host"
if USE_BLOCK_LIST == "1" and not fs.access(file_block_host) then
local block_domain, lookup_block_domain = {}, {}
local geosite_arg = ""
@@ -170,7 +169,7 @@ if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
end
--始终用国内DNS解析节点域名
local file_vpslist = TMP_ACL_PATH .. "/vpslist"
local file_vpslist = TMP_PATH .. "/vpslist"
if not is_file_nonzero(file_vpslist) then
local f_out = io.open(file_vpslist, "w")
local written_domains = {}
@@ -214,7 +213,7 @@ if is_file_nonzero(file_vpslist) then
end
--直连(白名单)列表
local file_direct_host = TMP_ACL_PATH .. "/direct_host"
local file_direct_host = CACHE_RULES_PATH .. "/direct_host"
if USE_DIRECT_LIST == "1" and not fs.access(file_direct_host) then
local direct_domain, lookup_direct_domain = {}, {}
local geosite_arg = ""
@@ -264,7 +263,7 @@ if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
end
--代理(黑名单)列表
local file_proxy_host = TMP_ACL_PATH .. "/proxy_host"
local file_proxy_host = CACHE_RULES_PATH .. "/proxy_host"
if USE_PROXY_LIST == "1" and not fs.access(file_proxy_host) then
local proxy_domain, lookup_proxy_domain = {}, {}
local geosite_arg = ""
@@ -382,9 +381,11 @@ end
if IS_SHUNT_NODE then
local white_domain, lookup_white_domain = {}, {}
local shunt_domain, lookup_shunt_domain = {}, {}
local file_white_host = FLAG_PATH .. "/shunt_direct_host"
local file_shunt_host = FLAG_PATH .. "/shunt_proxy_host"
local CACHE_FLAG_PATH = CACHE_RULES_PATH .. "/" .. FLAG
local file_white_host = CACHE_FLAG_PATH .. "/shunt_direct_host"
local file_shunt_host = CACHE_FLAG_PATH .. "/shunt_proxy_host"
local geosite_white_arg, geosite_shunt_arg = "", ""
local SHUNT_LIST = ""
local t = api.uci_get_c(NODE)
local default_node_id = t["default_node"] or "_direct"
@@ -421,12 +422,26 @@ if IS_SHUNT_NODE then
end
end
SHUNT_LIST = SHUNT_LIST .. domain_list .. _node_id
if _node_id ~= "_direct" then
log(string.format(" - Sing-Box/Xray分流规则(%s):%s", s.remarks, DNS_TRUST or "默认"))
end
end
end)
local MD5_FILE = CACHE_FLAG_PATH .. "/md5.txt"
local cache_md5 = ""
if fs.access(MD5_FILE) then
cache_md5 = fs.readfile(MD5_FILE)
end
local new_md5 = api.md5_string(SHUNT_LIST)
if cache_md5 == "" or new_md5 == "" or cache_md5 ~= new_md5 then
api.remove(CACHE_FLAG_PATH)
sys.call("mkdir -p %s" % CACHE_FLAG_PATH)
fs.writefile(MD5_FILE, new_md5)
end
if is_file_nonzero(file_white_host) == nil then
if #white_domain > 0 then
local f_out = io.open(file_white_host, "w")
@@ -29,10 +29,10 @@ local fs = api.fs
local datatypes = api.datatypes
local TMP_PATH = api.TMP_PATH
local TMP_ACL_PATH = TMP_PATH .. "/acl"
local RULES_PATH = "/usr/share/passwall/rules"
local USER_RULES_PATH = "/etc/passwall/rules"
local FLAG_PATH = TMP_ACL_PATH .. "/" .. FLAG
local CACHE_RULES_PATH = api.CACHE_PATH .. "/user_rules"
local FLAG_PATH = TMP_PATH .. "/acl/" .. FLAG
local TMP_CONF_FILE = FLAG_PATH .. "/smartdns.conf"
local config_lines = {}
local tmp_lines = {}
@@ -110,9 +110,8 @@ local function get_geosite(list_arg, out_path)
return 1
end
if not fs.access(FLAG_PATH) then
fs.mkdir(FLAG_PATH)
end
sys.call("mkdir -p %s" % FLAG_PATH)
sys.call("mkdir -p %s" % CACHE_RULES_PATH)
local LOCAL_EXTEND_ARG = ""
if LOCAL_GROUP == "null" or LOCAL_GROUP == "" then
@@ -285,7 +284,7 @@ for i = 1, 8 do
end
--屏蔽列表
local file_block_host = TMP_ACL_PATH .. "/block_host"
local file_block_host = CACHE_RULES_PATH .. "/block_host"
if USE_BLOCK_LIST == "1" and not fs.access(file_block_host) then
local block_domain, lookup_block_domain = {}, {}
local geosite_arg = ""
@@ -329,7 +328,7 @@ if USE_BLOCK_LIST == "1" and is_file_nonzero(file_block_host) then
end
--始终用国内DNS解析节点域名
local file_vpslist = TMP_ACL_PATH .. "/vpslist"
local file_vpslist = TMP_PATH .. "/vpslist"
if not is_file_nonzero(file_vpslist) then
local f_out = io.open(file_vpslist, "w")
local written_domains = {}
@@ -375,7 +374,7 @@ if is_file_nonzero(file_vpslist) then
end
--直连(白名单)列表
local file_direct_host = TMP_ACL_PATH .. "/direct_host"
local file_direct_host = CACHE_RULES_PATH .. "/direct_host"
if USE_DIRECT_LIST == "1" and not fs.access(file_direct_host) then
local direct_domain, lookup_direct_domain = {}, {}
local geosite_arg = ""
@@ -427,7 +426,7 @@ if USE_DIRECT_LIST == "1" and is_file_nonzero(file_direct_host) then
end
--代理(黑名单)列表
local file_proxy_host = TMP_ACL_PATH .. "/proxy_host"
local file_proxy_host = CACHE_RULES_PATH .. "/proxy_host"
if USE_PROXY_LIST == "1" and not fs.access(file_proxy_host) then
local proxy_domain, lookup_proxy_domain = {}, {}
local geosite_arg = ""
@@ -550,9 +549,11 @@ end
if IS_SHUNT_NODE then
local white_domain, lookup_white_domain = {}, {}
local shunt_domain, lookup_shunt_domain = {}, {}
local file_white_host = FLAG_PATH .. "/shunt_direct_host"
local file_shunt_host = FLAG_PATH .. "/shunt_proxy_host"
local CACHE_FLAG_PATH = CACHE_RULES_PATH .. "/" .. FLAG
local file_white_host = CACHE_FLAG_PATH .. "/shunt_direct_host"
local file_shunt_host = CACHE_FLAG_PATH .. "/shunt_proxy_host"
local geosite_white_arg, geosite_shunt_arg = "", ""
local SHUNT_LIST = ""
local t = api.uci_get_c(NODE)
local default_node_id = t["default_node"] or "_direct"
@@ -589,12 +590,26 @@ if IS_SHUNT_NODE then
end
end
SHUNT_LIST = SHUNT_LIST .. domain_list .. _node_id
if _node_id ~= "_direct" then
log(string.format(" - Sing-Box/Xray分流规则(%s)使用分组:%s", s.remarks, REMOTE_GROUP or "默认"))
end
end
end)
local MD5_FILE = CACHE_FLAG_PATH .. "/md5.txt"
local cache_md5 = ""
if fs.access(MD5_FILE) then
cache_md5 = fs.readfile(MD5_FILE)
end
local new_md5 = api.md5_string(SHUNT_LIST)
if cache_md5 == "" or new_md5 == "" or cache_md5 ~= new_md5 then
api.remove(CACHE_FLAG_PATH)
sys.call("mkdir -p %s" % CACHE_FLAG_PATH)
fs.writefile(MD5_FILE, new_md5)
end
if is_file_nonzero(file_white_host) == nil then
if #white_domain > 0 then
local f_out = io.open(file_white_host, "w")
@@ -1567,6 +1567,7 @@ stop() {
rm -rf $TMP_PATH2/singbox*
rm -rf $TMP_PATH2/dnsmasq*
rm -rf $TMP_PATH2/geo_output
rm -rf $TMP_PATH2/user_rules
}
flush_include
}
@@ -1606,6 +1606,7 @@ stop() {
rm -rf $TMP_PATH2/singbox*
rm -rf $TMP_PATH2/dnsmasq*
rm -rf $TMP_PATH2/geo_output
rm -rf $TMP_PATH2/user_rules
}
flush_include
}