diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index ac21d8b6..d01cac1c 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=26.9.26 +PKG_VERSION:=26.9.27 PKG_RELEASE:=1 PKG_PO_VERSION:=$(PKG_VERSION) @@ -153,15 +153,7 @@ endef define Package/$(PKG_NAME)/conffiles /etc/config/passwall /etc/config/passwall_server -/usr/share/passwall/rules/direct_host -/usr/share/passwall/rules/direct_ip -/usr/share/passwall/rules/proxy_host -/usr/share/passwall/rules/proxy_ip -/usr/share/passwall/rules/block_host -/usr/share/passwall/rules/block_ip -/usr/share/passwall/rules/lanlist_ipv4 -/usr/share/passwall/rules/lanlist_ipv6 -/usr/share/passwall/rules/domains_excluded +/etc/passwall/ endef define Package/$(PKG_NAME)/postinst diff --git a/luci-app-passwall/luasrc/controller/passwall.lua b/luci-app-passwall/luasrc/controller/passwall.lua index 71ec33ca..428b9003 100644 --- a/luci-app-passwall/luasrc/controller/passwall.lua +++ b/luci-app-passwall/luasrc/controller/passwall.lua @@ -20,6 +20,7 @@ function index() luci.sys.call('cp -f /usr/share/passwall/0_default_config /etc/config/passwall') else return end end + luci.sys.call("mkdir -p /etc/passwall/rules") local api = require "luci.passwall.api" local appname = api.appname -- global definitions not available local fs = api.fs @@ -854,13 +855,15 @@ end local backup_files = { "/etc/config/passwall", "/etc/config/passwall_server", - "/usr/share/passwall/rules/block_host", - "/usr/share/passwall/rules/block_ip", - "/usr/share/passwall/rules/direct_host", - "/usr/share/passwall/rules/direct_ip", - "/usr/share/passwall/rules/proxy_host", - "/usr/share/passwall/rules/proxy_ip", - "/usr/share/passwall/rules/domains_excluded" + "/etc/passwall/rules/block_host", + "/etc/passwall/rules/block_ip", + "/etc/passwall/rules/direct_host", + "/etc/passwall/rules/direct_ip", + "/etc/passwall/rules/proxy_host", + "/etc/passwall/rules/proxy_ip", + "/etc/passwall/rules/lanlist_ipv4", + "/etc/passwall/rules/lanlist_ipv6", + "/etc/passwall/rules/domains_excluded" } function create_backup() @@ -965,6 +968,13 @@ function reset_config() luci.sys.call('/etc/init.d/passwall stop') if luci.sys.call('[ -s "/usr/share/passwall/0_default_config" ]') == 0 then luci.sys.call('cp -f /usr/share/passwall/0_default_config /etc/config/passwall') + local files = { + "direct_host", "direct_ip", "proxy_host", "proxy_ip", "block_host", "block_ip", + "lanlist_ipv4", "lanlist_ipv6", "domains_excluded" + } + for _, f in ipairs(files) do + luci.sys.call("cp -f /usr/share/passwall/rules/" .. f .. " /etc/passwall/rules/" .. f) + end api.log(" * 恢复默认配置成功。") else api.log(" * 找不到默认配置文件,重置失败!") diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index dccc96bd..94d826d0 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -193,7 +193,7 @@ if has_xray then o.default = 0 o.description = translate("Override the connection destination address with the sniffed domain.
Otherwise use sniffed domain for routing only.
If using shunt nodes, configure the domain shunt rules correctly.") - local domains_excluded = string.format("/usr/share/%s/rules/domains_excluded", m.config) + local domains_excluded = string.format("/etc/%s/rules/domains_excluded", m.config) o = s_xray:option(TextValue, "excluded_domains", translate("Excluded Domains"), translate("If the traffic sniffing result is in this list, the destination address will not be overridden.")) o.rows = 15 o.wrap = "off" diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua index 4b0f89cd..063e46fd 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua @@ -2,10 +2,10 @@ local api = require "luci.passwall.api" local fs = api.fs local sys = api.sys local datatypes = api.datatypes -local path = string.format("/usr/share/%s/rules/", api.appname) -local gfwlist_path = path .. "gfwlist" -local chnlist_path = path .. "chnlist" -local chnroute_path = path .. "chnroute" +local path = string.format("/etc/%s/rules/", api.appname) +local gfwlist_path = "/usr/share/" .. api.appname .. "/rules/gfwlist" +local chnlist_path = "/usr/share/" .. api.appname .. "/rules/chnlist" +local chnroute_path = "/usr/share/" .. api.appname .. "/rules/chnroute" api.set_default_cbi() diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index 8af3ee18..d26018c1 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -1643,8 +1643,8 @@ function gen_config(var) return table.concat(list, "\n") end - local domain_list = read_proxy_list("/usr/share/passwall/rules/proxy_host") - local ip_list = read_proxy_list("/usr/share/passwall/rules/proxy_ip") + local domain_list = read_proxy_list("/etc/passwall/rules/proxy_host") + local ip_list = read_proxy_list("/etc/passwall/rules/proxy_ip") local bin = api.finded_com("geoview") if bin then diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index bf283dd6..64720944 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -15,7 +15,7 @@ local xray_version = api.get_app_version("xray") local xray_min_version = "26.7.11" local function get_domain_excluded() - local path = string.format("/usr/share/%s/rules/domains_excluded", api.c_config) + local path = string.format("/etc/%s/rules/domains_excluded", api.c_config) local content = fs.readfile(path) if not content then return nil end local hosts = {} @@ -1425,8 +1425,8 @@ function gen_config(var) return table.concat(list, "\n") end - local domain_list = read_proxy_list("/usr/share/passwall/rules/proxy_host") - local ip_list = read_proxy_list("/usr/share/passwall/rules/proxy_ip") + local domain_list = read_proxy_list("/etc/passwall/rules/proxy_host") + local ip_list = read_proxy_list("/etc/passwall/rules/proxy_ip") local bin = api.finded_com("geoview") if bin then diff --git a/luci-app-passwall/root/etc/uci-defaults/luci-app-passwall b/luci-app-passwall/root/etc/uci-defaults/luci-app-passwall index a1298483..7ae704e8 100755 --- a/luci-app-passwall/root/etc/uci-defaults/luci-app-passwall +++ b/luci-app-passwall/root/etc/uci-defaults/luci-app-passwall @@ -31,6 +31,21 @@ uci commit firewall [ ! -s "/etc/config/passwall" ] && cp -f /usr/share/passwall/0_default_config /etc/config/passwall +mkdir -p /etc/passwall/rules +for file in \ + direct_host \ + direct_ip \ + proxy_host \ + proxy_ip \ + block_host \ + block_ip \ + lanlist_ipv4 \ + lanlist_ipv6 \ + domains_excluded +do + [ -f "/etc/passwall/rules/$file" ] || cp "/usr/share/passwall/rules/$file" "/etc/passwall/rules/$file" +done + chmod +x /usr/share/passwall/*.sh [ "$(uci -q get passwall.@global_xray[0].sniffing)" == "1" ] && [ "$(uci -q get passwall.@global_xray[0].route_only)" != "1" ] && uci -q set passwall.@global_xray[0].sniffing_override_dest=1 diff --git a/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua b/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua index c8540333..1a342842 100644 --- a/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua +++ b/luci-app-passwall/root/usr/share/passwall/helper_chinadns_add.lua @@ -26,6 +26,7 @@ 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 config_lines = {} local tmp_lines = {} @@ -130,7 +131,7 @@ local file_block_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/block_host") + local f = io.open(USER_RULES_PATH .. "/block_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -217,7 +218,7 @@ local file_direct_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/direct_host") + local f = io.open(USER_RULES_PATH .. "/direct_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -267,7 +268,7 @@ local file_proxy_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/proxy_host") + local f = io.open(USER_RULES_PATH .. "/proxy_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then diff --git a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua index 20b5704f..cd7401c1 100644 --- a/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua +++ b/luci-app-passwall/root/usr/share/passwall/helper_dnsmasq.lua @@ -336,6 +336,7 @@ function add_rule(var) local cache_text = "" local nodes_address_md5 = sys.exec("echo -n $(uci show passwall | grep '\\.address') | md5sum") local new_rules = sys.exec("echo -n $(find /usr/share/passwall/rules -type f | xargs md5sum)") + new_rules = new_rules .. sys.exec("echo -n $(find /etc/passwall/rules -type f | xargs md5sum)") local new_text = TMP_DNSMASQ_PATH .. DNSMASQ_CONF_FILE .. DEFAULT_DNS .. LOCAL_DNS .. TUN_DNS .. USE_DEFAULT_DNS .. CHINADNS_DNS .. USE_DIRECT_LIST .. USE_PROXY_LIST .. USE_BLOCK_LIST .. USE_GFW_LIST .. CHN_LIST .. DEFAULT_PROXY_MODE .. NO_PROXY_IPV6 .. nodes_address_md5 .. new_rules .. NFTFLAG if fs.access(CACHE_TEXT_FILE) then for line in io.lines(CACHE_TEXT_FILE) do @@ -380,7 +381,7 @@ function add_rule(var) --屏蔽列表 if USE_CHINADNS_NG == "0" and USE_BLOCK_LIST == "1" then local geosite_arg = "" - local f = io.open("/usr/share/passwall/rules/block_host") + local f = io.open("/etc/passwall/rules/block_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -455,7 +456,7 @@ function add_rule(var) } --始终用国内DNS解析直连(白名单)列表 local geosite_arg = "" - local f = io.open("/usr/share/passwall/rules/direct_host") + local f = io.open("/etc/passwall/rules/direct_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -505,7 +506,7 @@ function add_rule(var) end --始终使用远程DNS解析代理(黑名单)列表 local geosite_arg = "" - local f = io.open("/usr/share/passwall/rules/proxy_host") + local f = io.open("/etc/passwall/rules/proxy_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then diff --git a/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua b/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua index b8f9614c..7ce004ff 100644 --- a/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua +++ b/luci-app-passwall/root/usr/share/passwall/helper_smartdns_add.lua @@ -31,6 +31,7 @@ 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 TMP_CONF_FILE = FLAG_PATH .. "/smartdns.conf" local config_lines = {} @@ -288,7 +289,7 @@ local file_block_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/block_host") + local f = io.open(USER_RULES_PATH .. "/block_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -378,7 +379,7 @@ local file_direct_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/direct_host") + local f = io.open(USER_RULES_PATH .. "/direct_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then @@ -430,7 +431,7 @@ local file_proxy_host = TMP_ACL_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 = "" - local f = io.open(RULES_PATH .. "/proxy_host") + local f = io.open(USER_RULES_PATH .. "/proxy_host") if f then for line in f:lines() do if not line:find("#") and line:find("geosite:") then diff --git a/luci-app-passwall/root/usr/share/passwall/iptables.sh b/luci-app-passwall/root/usr/share/passwall/iptables.sh index 2ce9ebb1..e2ff5cdc 100755 --- a/luci-app-passwall/root/usr/share/passwall/iptables.sh +++ b/luci-app-passwall/root/usr/share/passwall/iptables.sh @@ -936,10 +936,10 @@ add_firewall_rule() { #直连列表 [ "$USE_DIRECT_LIST_ALL" = "1" ] && { - cat $RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_WHITE &/g" -e "s/$/ timeout 0/g" | ipset -! -R - cat $RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_WHITE6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_WHITE &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_WHITE6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | sed -e "s/^/add $IPSET_WHITE &/g" -e "s/$/ timeout 0/g" | ipset -! -R get_geoip $GEOIP_CODE ipv6 | sed -e "s/^/add $IPSET_WHITE6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R @@ -950,10 +950,10 @@ add_firewall_rule() { #代理列表 [ "$USE_PROXY_LIST_ALL" = "1" ] && { - cat $RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_BLACK &/g" -e "s/$/ timeout 0/g" | ipset -! -R - cat $RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_BLACK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_BLACK &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_BLACK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | sed -e "s/^/add $IPSET_BLACK &/g" -e "s/$/ timeout 0/g" | ipset -! -R get_geoip $GEOIP_CODE ipv6 | sed -e "s/^/add $IPSET_BLACK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R @@ -964,10 +964,10 @@ add_firewall_rule() { #屏蔽列表 [ "$USE_BLOCK_LIST_ALL" = "1" ] && { - cat $RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_BLOCK &/g" -e "s/$/ timeout 0/g" | ipset -! -R - cat $RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_BLOCK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv4_REGEX" | sed -e "s/^/add $IPSET_BLOCK &/g" -e "s/$/ timeout 0/g" | ipset -! -R + cat $USER_RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed 's/#.*//' | grep -E "$IPv6_REGEX" | sed -e "s/^/add $IPSET_BLOCK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | sed -e "s/^/add $IPSET_BLOCK &/g" -e "s/$/ timeout 0/g" | ipset -! -R get_geoip $GEOIP_CODE ipv6 | sed -e "s/^/add $IPSET_BLOCK6 &/g" -e "s/$/ timeout 0/g" | ipset -! -R diff --git a/luci-app-passwall/root/usr/share/passwall/nftables.sh b/luci-app-passwall/root/usr/share/passwall/nftables.sh index 76ae3001..35225125 100755 --- a/luci-app-passwall/root/usr/share/passwall/nftables.sh +++ b/luci-app-passwall/root/usr/share/passwall/nftables.sh @@ -1042,10 +1042,10 @@ add_firewall_rule() { #直连列表 [ "$USE_DIRECT_LIST_ALL" = "1" ] && { - cat $RULES_PATH/direct_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_WHITE_STATIC - cat $RULES_PATH/direct_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_WHITE6_STATIC + cat $USER_RULES_PATH/direct_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_WHITE_STATIC + cat $USER_RULES_PATH/direct_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_WHITE6_STATIC [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/direct_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | insert_nftset $NFTSET_WHITE_STATIC get_geoip $GEOIP_CODE ipv6 | insert_nftset $NFTSET_WHITE6_STATIC @@ -1056,10 +1056,10 @@ add_firewall_rule() { #代理列表 [ "$USE_PROXY_LIST_ALL" = "1" ] && { - cat $RULES_PATH/proxy_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_BLACK_STATIC - cat $RULES_PATH/proxy_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_BLACK6_STATIC + cat $USER_RULES_PATH/proxy_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_BLACK_STATIC + cat $USER_RULES_PATH/proxy_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_BLACK6_STATIC [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/proxy_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | insert_nftset $NFTSET_BLACK_STATIC get_geoip $GEOIP_CODE ipv6 | insert_nftset $NFTSET_BLACK6_STATIC @@ -1070,10 +1070,10 @@ add_firewall_rule() { #屏蔽列表 [ "$USE_BLOCK_LIST_ALL" = "1" ] && { - cat $RULES_PATH/block_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_BLOCK_STATIC - cat $RULES_PATH/block_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_BLOCK6_STATIC + cat $USER_RULES_PATH/block_ip | sed 's/#.*//' | grep -E "$IPv4_REGEX" | insert_nftset $NFTSET_BLOCK_STATIC + cat $USER_RULES_PATH/block_ip | sed 's/#.*//' | grep -E "$IPv6_REGEX" | insert_nftset $NFTSET_BLOCK6_STATIC [ "$USE_GEOVIEW" = "1" ] && { - local GEOIP_CODE=$(cat $RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') + local GEOIP_CODE=$(cat $USER_RULES_PATH/block_ip | tr -s "\r\n" "\n" | sed -e "/^$/d" | grep -E "^geoip:" | grep -v "^geoip:private" | sed -E 's/^geoip:(.*)/\1/' | sed ':a;N;$!ba;s/\n/,/g') if [ -n "$GEOIP_CODE" ]; then get_geoip $GEOIP_CODE ipv4 | insert_nftset $NFTSET_BLOCK_STATIC get_geoip $GEOIP_CODE ipv6 | insert_nftset $NFTSET_BLOCK6_STATIC diff --git a/luci-app-passwall/root/usr/share/passwall/utils.sh b/luci-app-passwall/root/usr/share/passwall/utils.sh index 9b0839ce..fdc72d49 100755 --- a/luci-app-passwall/root/usr/share/passwall/utils.sh +++ b/luci-app-passwall/root/usr/share/passwall/utils.sh @@ -14,6 +14,7 @@ TMP_IFACE_PATH=${TMP_PATH}/iface TMP_ROUTE_PATH=${TMP_PATH}/route TMP_SCRIPT_FUNC_PATH=${TMP_PATH}/script_func RULES_PATH=/usr/share/${CONFIG}/rules +USER_RULES_PATH=/etc/${CONFIG}/rules IPv6_REGEX="([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|" IPv6_REGEX="${IPv6_REGEX}([0-9a-fA-F]{1,4}:){1,7}:|" @@ -493,11 +494,11 @@ get_subscribe_host(){ } gen_lanlist() { - cat $RULES_PATH/lanlist_ipv4 | tr -s '\n' | grep -v "^#" + cat $USER_RULES_PATH/lanlist_ipv4 | tr -s '\n' | grep -v "^#" } gen_lanlist_6() { - cat $RULES_PATH/lanlist_ipv6 | tr -s '\n' | grep -v "^#" + cat $USER_RULES_PATH/lanlist_ipv6 | tr -s '\n' | grep -v "^#" } get_wan_ips() { diff --git a/oxidns/Makefile b/oxidns/Makefile index 766244aa..db794c3a 100644 --- a/oxidns/Makefile +++ b/oxidns/Makefile @@ -1,16 +1,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=oxidns -PKG_VERSION:=1.6.0 -PKG_RELEASE:=1 +PKG_VERSION:=1.6.0 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/svenshi/oxidns.git -PKG_SOURCE_DATE:=2026-09-26 -PKG_SOURCE_VERSION:=5e83394976790f60bd4ed0f059aa65ea1c279c21 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_DATE:=2026-09-26 +PKG_SOURCE_VERSION:=5e83394976790f60bd4ed0f059aa65ea1c279c21 +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.zst -PKG_MIRROR_HASH:=skip +PKG_MIRROR_HASH:=skip PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE_FILES:=LICENSE @@ -19,11 +19,10 @@ PKG_MAINTAINER:=Sven Shi PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_oxidns-webui # rust 是编译 oxidns 本体必需;node/npm 只在需要构建 webui 时才依赖 -PKG_BUILD_DEPENDS:=rust/host PACKAGE_oxidns-webui:node/host PACKAGE_oxidns-webui:npm/host +PKG_BUILD_DEPENDS:=rust/host PACKAGE_oxidns-webui:node/host PKG_BUILD_PARALLEL:=1 -# webui 前端构建产物目录(Vite 默认 dist,若是 out 请改这里) -WEBUI_DIST:=dist +WEBUI_DIST:=out include $(INCLUDE_DIR)/package.mk include $(TOPDIR)/feeds/packages/lang/rust/rust-package.mk