mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 09:13:56 +08:00
🎉 Sync 2026-08-28 01:19:01
This commit is contained in:
1 parent
3ebef8b234
commit
a0bd643038
27 files changed
+202
-141
No files matched your search
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.8.26
|
||||
PKG_RELEASE:=247
|
||||
PKG_RELEASE:=248
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -829,6 +829,8 @@ function rollback_rules()
|
||||
if geo2rule == "1" and rules ~= "" then
|
||||
luci.sys.call("lua /usr/share/passwall/rule_update.lua log '" .. rules .. "' rollback > /dev/null")
|
||||
end
|
||||
uci_set("@global[0]", "flush_set", "1")
|
||||
uci_save(true)
|
||||
http_write_json_ok()
|
||||
end
|
||||
|
||||
|
||||
@@ -402,6 +402,7 @@ end
|
||||
|
||||
---- DNS Forward
|
||||
o = s:option(Value, "remote_dns", translate("Remote DNS"))
|
||||
o.datatype = "or(ipaddr,ipaddrport(1))"
|
||||
o.default = "1.1.1.1"
|
||||
o:value("1.1.1.1", "1.1.1.1 (CloudFlare)")
|
||||
o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
|
||||
|
||||
@@ -213,7 +213,7 @@ o:depends({dns_shunt = "dnsmasq"})
|
||||
o:depends({dns_shunt = "chinadns-ng"})
|
||||
|
||||
o = s:taboption("DNS", Value, "direct_dns", translate("Direct DNS"))
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
o.datatype = "or(ipaddr,ipaddrport(1))"
|
||||
o.default = "223.5.5.5"
|
||||
o:value("223.5.5.5")
|
||||
o:value("223.6.6.6")
|
||||
@@ -389,7 +389,7 @@ o:depends({dns_mode = "dns2socks"})
|
||||
|
||||
---- DNS Forward
|
||||
o = s:taboption("DNS", Value, "remote_dns", translate("Remote DNS"))
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
o.datatype = "or(ipaddr,ipaddrport(1))"
|
||||
o.default = "1.1.1.1"
|
||||
o:value("1.1.1.1", "1.1.1.1 (CloudFlare)")
|
||||
o:value("1.1.1.2", "1.1.1.2 (CloudFlare-Security)")
|
||||
|
||||
@@ -69,13 +69,6 @@ local function convert_geofile()
|
||||
end
|
||||
local function convert(file_path, prefix, tags)
|
||||
if next(tags) and fs.access(file_path) then
|
||||
local md5_file = GEO_VAR.TO_SRS_PATH .. prefix .. ".dat.md5"
|
||||
local new_md5 = sys.exec("md5sum " .. file_path .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "")
|
||||
local old_md5 = sys.exec("[ -f " .. md5_file .. " ] && head -n 1 " .. md5_file .. " | tr -d ' \t\n' || echo ''")
|
||||
if new_md5 ~= "" and new_md5 ~= old_md5 then
|
||||
sys.call("printf '%s' " .. new_md5 .. " > " .. md5_file)
|
||||
sys.call("rm -rf " .. GEO_VAR.TO_SRS_PATH .. prefix .. "-*.srs" )
|
||||
end
|
||||
for k in pairs(tags) do
|
||||
geo_convert_srs({["geo_path"] = file_path, ["prefix"] = prefix, ["rule_name"] = k})
|
||||
end
|
||||
|
||||
@@ -1664,8 +1664,12 @@ function gen_config(var)
|
||||
_direct_dns.port = port
|
||||
_direct_dns.address = direct_dns_udp_server
|
||||
elseif direct_dns_tcp_server then
|
||||
if api.is_ipv6(direct_dns_tcp_server) then
|
||||
direct_dns_tcp_server = api.get_ipv6_full(direct_dns_tcp_server)
|
||||
end
|
||||
local port = tonumber(direct_dns_port) or 53
|
||||
_direct_dns.address = "tcp://" .. direct_dns_tcp_server .. ":" .. port
|
||||
_direct_dns.port = port
|
||||
end
|
||||
|
||||
if COMMON.default_outbound_tag == "direct" then
|
||||
@@ -1697,7 +1701,11 @@ function gen_config(var)
|
||||
_remote_dns.port = tonumber(remote_dns_udp_port) or 53
|
||||
|
||||
elseif remote_dns_tcp_server then
|
||||
if api.is_ipv6(remote_dns_tcp_server) then
|
||||
remote_dns_tcp_server = api.get_ipv6_full(remote_dns_tcp_server)
|
||||
end
|
||||
_remote_dns.address = "tcp://" .. remote_dns_tcp_server .. ":" .. tonumber(remote_dns_tcp_port) or 53
|
||||
_remote_dns.port = tonumber(remote_dns_tcp_port) or 53
|
||||
|
||||
elseif remote_dns_doh then
|
||||
local _a = api.parseDoH(remote_dns_doh)
|
||||
|
||||
@@ -44,6 +44,7 @@ FAKE_IP="198.18.0.0/15"
|
||||
FAKE_IP_6="fc00::/18"
|
||||
|
||||
USE_GEOVIEW=0
|
||||
EXCLUDE_VPSIP="^(0\.0\.0\.0|127\.0\.0\.1|1\.1\.1\.1|1\.1\.1\.2|8\.8\.8\.8|8\.8\.4\.4|9\.9\.9\.9)$"
|
||||
|
||||
factor() {
|
||||
if [ -z "$1" ] || [ -z "$2" ]; then
|
||||
@@ -746,15 +747,14 @@ load_acl() {
|
||||
}
|
||||
|
||||
filter_haproxy() {
|
||||
for item in ${haproxy_items}; do
|
||||
local ip=$(get_host_ip ipv4 $(echo $item | awk -F ":" '{print $1}') 1)
|
||||
ipset -q add $IPSET_VPS $ip
|
||||
for item in $(uci show $CONFIG | grep ".lbss=" | cut -d "'" -f 2); do
|
||||
local ip=$(get_host_ip "ipv4" "$(echo $item | awk -F ":" '{print $1}')" 1)
|
||||
[ -n "$ip" ] && ! echo "$ip" | grep -Eq "$EXCLUDE_VPSIP" && ipset -q add $IPSET_VPS $ip
|
||||
done
|
||||
echolog " - [$?]加入负载均衡的节点到ipset[$IPSET_VPS]直连完成"
|
||||
}
|
||||
|
||||
filter_vpsip() {
|
||||
local EXCLUDE_VPSIP="^(0\.0\.0\.0|127\.0\.0\.1|1\.1\.1\.1|1\.1\.1\.2|8\.8\.8\.8|8\.8\.4\.4|9\.9\.9\.9)$"
|
||||
uci show $CONFIG | grep -E "(\.address=|\.download_address=|\.domain_resolver_dns=|\.domain_resolver_dns_https=)" | cut -d "'" -f 2 | grep -Eo "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -Ev "$EXCLUDE_VPSIP" | sed "s/^/add $IPSET_VPS /" | awk '1; END{print "COMMIT"}' | ipset -! -R
|
||||
echolog " - [$?]加入所有IPv4节点到ipset[$IPSET_VPS]直连完成"
|
||||
uci show $CONFIG | grep -E "(\.address=|\.download_address=|\.domain_resolver_dns=|\.domain_resolver_dns_https=)" | cut -d "'" -f 2 | grep -Eo "\[?[A-Fa-f0-9:]*:[A-Fa-f0-9:]+\]?" | sed "s/^/add $IPSET_VPS6 /" | awk '1; END{print "COMMIT"}' | ipset -! -R
|
||||
@@ -802,7 +802,9 @@ filter_node() {
|
||||
local port=$(config_n_get "$node" port)
|
||||
local hop=$(config_n_get "$node" hysteria2_hop)
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -z "$address" ] || [ -z "$port" ] && return 1
|
||||
[ -z "$address" ] && return 1
|
||||
echo "$address" | grep -Eq "$EXCLUDE_VPSIP" && return 1
|
||||
[ -z "$port" ] && return 1
|
||||
filter_server_port "$address" "$port" "$stream"
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ FAKE_IP="198.18.0.0/15"
|
||||
FAKE_IP_6="fc00::/18"
|
||||
|
||||
USE_GEOVIEW=0
|
||||
EXCLUDE_VPSIP="^(0\.0\.0\.0|127\.0\.0\.1|1\.1\.1\.1|1\.1\.1\.2|8\.8\.8\.8|8\.8\.4\.4|9\.9\.9\.9)$"
|
||||
|
||||
factor() {
|
||||
local ports="$1"
|
||||
@@ -809,24 +810,23 @@ load_acl() {
|
||||
}
|
||||
|
||||
filter_haproxy() {
|
||||
for item in ${haproxy_items}; do
|
||||
get_host_ip ipv4 $(echo $item | awk -F ":" '{print $1}') 1
|
||||
done | insert_nftset $NFTSET_VPS
|
||||
for item in $(uci show $CONFIG | grep ".lbss=" | cut -d "'" -f 2); do
|
||||
get_host_ip "ipv4" "$(echo $item | awk -F ":" '{print $1}')" 1
|
||||
done | grep -Ev "$EXCLUDE_VPSIP" | insert_nftset $NFTSET_VPS
|
||||
echolog " - [$?]加入负载均衡的节点到nftset[$NFTSET_VPS]直连完成"
|
||||
}
|
||||
|
||||
filter_vps_addr() {
|
||||
for server_host in "$@"; do
|
||||
get_host_ip "ipv4" ${server_host}
|
||||
done | insert_nftset $NFTSET_VPS
|
||||
get_host_ip "ipv4" "${server_host}"
|
||||
done | grep -Ev "$EXCLUDE_VPSIP" | insert_nftset $NFTSET_VPS
|
||||
|
||||
for server_host in "$@"; do
|
||||
get_host_ip "ipv6" ${server_host}
|
||||
get_host_ip "ipv6" "${server_host}"
|
||||
done | insert_nftset $NFTSET_VPS6
|
||||
}
|
||||
|
||||
filter_vpsip() {
|
||||
local EXCLUDE_VPSIP="^(0\.0\.0\.0|127\.0\.0\.1|1\.1\.1\.1|1\.1\.1\.2|8\.8\.8\.8|8\.8\.4\.4|9\.9\.9\.9)$"
|
||||
uci show $CONFIG | grep -E "(\.address=|\.download_address=|\.domain_resolver_dns=|\.domain_resolver_dns_https=)" | cut -d "'" -f 2 | grep -Eo "([0-9]{1,3}\.){3}[0-9]{1,3}" | grep -Ev "$EXCLUDE_VPSIP" | insert_nftset $NFTSET_VPS
|
||||
echolog " - [$?]加入所有IPv4节点到nftset[$NFTSET_VPS]直连完成"
|
||||
uci show $CONFIG | grep -E "(\.address=|\.download_address=|\.domain_resolver_dns=|\.domain_resolver_dns_https=)" | cut -d "'" -f 2 | grep -Eo "\[?[A-Fa-f0-9:]*:[A-Fa-f0-9:]+\]?" | insert_nftset $NFTSET_VPS6
|
||||
@@ -864,7 +864,9 @@ filter_node() {
|
||||
local port=$(config_n_get "$node" port)
|
||||
local hop=$(config_n_get "$node" hysteria2_hop)
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -z "$address" ] || [ -z "$port" ] && return 1
|
||||
[ -z "$address" ] && return 1
|
||||
echo "$address" | grep -Eq "$EXCLUDE_VPSIP" && return 1
|
||||
[ -z "$port" ] && return 1
|
||||
filter_server_port "$address" "$port" "$stream"
|
||||
}
|
||||
|
||||
@@ -877,7 +879,6 @@ filter_direct_node_list() {
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
del_script_mwan3() {
|
||||
[ -s "/etc/init.d/mwan3" ] && sed -i "/${CONFIG}/d" /etc/init.d/mwan3 >/dev/null 2>&1
|
||||
}
|
||||
|
||||
@@ -726,13 +726,21 @@ if geo2rule == "1" then
|
||||
end
|
||||
|
||||
-- 如果是手动更新(arg2存在)始终生成规则
|
||||
if arg2 then geoip_update_ok, geosite_update_ok = true, true end
|
||||
chnroute_update, chnroute6_update, gfwlist_update, chnlist_update = "1", "1", "1", "1"
|
||||
if arg2 then
|
||||
geoip_update_ok, geosite_update_ok = true, true
|
||||
end
|
||||
if not rollback then
|
||||
chnroute_update, chnroute6_update, gfwlist_update, chnlist_update = "1", "1", "1", "1"
|
||||
end
|
||||
|
||||
if geoip_update_ok then
|
||||
if fs.access(asset_location .. "geoip.dat") then
|
||||
safe_call(fetch_chnroute, "生成chnroute发生错误...")
|
||||
safe_call(fetch_chnroute6, "生成chnroute6发生错误...")
|
||||
if chnroute_update == "1" then
|
||||
safe_call(fetch_chnroute, "生成chnroute发生错误...")
|
||||
end
|
||||
if chnroute6_update == "1" then
|
||||
safe_call(fetch_chnroute6, "生成chnroute6发生错误...")
|
||||
end
|
||||
else
|
||||
log("geoip.dat 文件不存在,跳过规则生成。")
|
||||
end
|
||||
@@ -740,8 +748,12 @@ if geo2rule == "1" then
|
||||
|
||||
if geosite_update_ok then
|
||||
if fs.access(asset_location .. "geosite.dat") then
|
||||
safe_call(fetch_gfwlist, "生成gfwlist发生错误...")
|
||||
safe_call(fetch_chnlist, "生成chnlist发生错误...")
|
||||
if gfwlist_update == "1" then
|
||||
safe_call(fetch_gfwlist, "生成gfwlist发生错误...")
|
||||
end
|
||||
if chnlist_update == "1" then
|
||||
safe_call(fetch_chnlist, "生成chnlist发生错误...")
|
||||
end
|
||||
else
|
||||
log("geosite.dat 文件不存在,跳过规则生成。")
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user