💋 Sync 2026-04-09 03:05:33

This commit is contained in:
github-actions[bot] committed 2026-04-09 03:05:33 +08:00
1 parent 9ee1d95299
commit fa527e2e56
4 files changed
+48 -39

No files matched your search

@@ -566,7 +566,7 @@ o = s:taboption("DNS", DynamicList, "ad_url", translate("Anti-AD Rules Subscribe
o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-domains.txt", translate("anti-AD")) o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-domains.txt", translate("anti-AD"))
o:value("https://cdn.jsdelivr.net/gh/neodevpro/neodevhost/domain", translate("NEO DEV HOST")) o:value("https://cdn.jsdelivr.net/gh/neodevpro/neodevhost/domain", translate("NEO DEV HOST"))
o.default = "https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-domains.txt" o.default = "https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-domains.txt"
o.description = translate("Support Domain and Dnsmasq format list") o.description = translate("Support Domain / Dnsmasq / Hosts format list")
o:depends("adblock",1) o:depends("adblock",1)
s:tab("Proxy", translate("Mode")) s:tab("Proxy", translate("Mode"))
+2 -2
View File
@@ -31,8 +31,8 @@ msgstr "上一次规则更新时间"
msgid "Subscribe Rules Data" msgid "Subscribe Rules Data"
msgstr "去广告规则" msgstr "去广告规则"
msgid "Support Domain and Dnsmasq format list" msgid "Support Domain / Dnsmasq / Hosts format list"
msgstr "支持域名和Dnsmasq格式的过滤列表" msgstr "支持 域名/Dnsmasq/Hosts 格式的过滤列表"
msgid "Anti-AD Rules Subscribe" msgid "Anti-AD Rules Subscribe"
msgstr "广告过滤列表URL" msgstr "广告过滤列表URL"
@@ -57,6 +57,8 @@ process_url() {
sample_count++ sample_count++
if (fmt == "" && $0 ~ /^address=\/[^\/]+\//) fmt = "dnsmasq" if (fmt == "" && $0 ~ /^address=\/[^\/]+\//) fmt = "dnsmasq"
if (fmt == "" && $0 ~ /^DOMAIN-SUFFIX,/) fmt = "clash" if (fmt == "" && $0 ~ /^DOMAIN-SUFFIX,/) fmt = "clash"
if (fmt == "" && $0 ~ /^(0\.0\.0\.0|127\.0\.0\.1)[[:space:]]/)
fmt = "hosts"
if (fmt == "" && $0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$/) if (fmt == "" && $0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$/)
fmt = "plain" fmt = "plain"
} }
@@ -68,6 +70,16 @@ process_url() {
if (n >= 3 && a[1] == "address=") print a[2] if (n >= 3 && a[1] == "address=") print a[2]
} else if (fmt == "clash") { } else if (fmt == "clash") {
if (sub(/^DOMAIN-SUFFIX,/, "")) print if (sub(/^DOMAIN-SUFFIX,/, "")) print
} else if (fmt == "hosts") {
# 0.0.0.0 domain.com 或 127.0.0.1 domain.com
if ($0 ~ /^(0\.0\.0\.0|127\.0\.0\.1)[[:space:]]/) {
domain = $2
# 去掉行尾可能的注释
gsub(/#.*/, "", domain)
gsub(/[[:space:]]/, "", domain)
if (domain != "" && domain != "localhost")
print domain
}
} else if (fmt == "plain") { } else if (fmt == "plain") {
if ($0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$/) if ($0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$/)
print print
@@ -17,6 +17,8 @@ UTIL_TROJAN=$LUA_UTIL_PATH/util_trojan.lua
UTIL_NAIVE=$LUA_UTIL_PATH/util_naiveproxy.lua UTIL_NAIVE=$LUA_UTIL_PATH/util_naiveproxy.lua
UTIL_HYSTERIA2=$LUA_UTIL_PATH/util_hysteria2.lua UTIL_HYSTERIA2=$LUA_UTIL_PATH/util_hysteria2.lua
UTIL_TUIC=$LUA_UTIL_PATH/util_tuic.lua UTIL_TUIC=$LUA_UTIL_PATH/util_tuic.lua
SINGBOX_BIN=$(first_type $(config_t_get global_app sing_box_file) sing-box)
XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray)
check_run_environment() { check_run_environment() {
local prefer_nft=$(config_t_get global_forwarding prefer_nft 1) local prefer_nft=$(config_t_get global_forwarding prefer_nft 1)
@@ -102,11 +104,8 @@ run_singbox() {
local loglevel log_file config_file server_host server_port no_run local loglevel log_file config_file server_host server_port no_run
eval_set_val $@ eval_set_val $@
[ -z "$type" ] && { [ -z "$type" ] && {
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
if [ "$type" != "sing-box" ]; then [ "$type" != "sing-box" ] && [ -n "$SINGBOX_BIN" ] && type="sing-box"
bin=$(first_type $(config_t_get global_app sing_box_file) sing-box)
[ -n "$bin" ] && type="sing-box"
fi
} }
[ -z "$type" ] && return 1 [ -z "$type" ] && return 1
[ -n "$log_file" ] || local log_file="/dev/null" [ -n "$log_file" ] || local log_file="/dev/null"
@@ -187,7 +186,7 @@ run_singbox() {
[ -n "$no_run" ] && json_add_string "no_run" "1" [ -n "$no_run" ] && json_add_string "no_run" "1"
local _json_arg="$(json_dump)" local _json_arg="$(json_dump)"
lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file
[ -n "$no_run" ] || ln_run "$(first_type $(config_t_get global_app sing_box_file) sing-box)" "sing-box" $log_file run -c "$config_file" [ -n "$no_run" ] || ln_run "$SINGBOX_BIN" "sing-box" $log_file run -c "$config_file"
} }
run_xray() { run_xray() {
@@ -196,11 +195,8 @@ run_xray() {
local loglevel log_file config_file server_host server_port no_run local loglevel log_file config_file server_host server_port no_run
eval_set_val $@ eval_set_val $@
[ -z "$type" ] && { [ -z "$type" ] && {
local type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z') type=$(echo $(config_n_get $node type) | tr 'A-Z' 'a-z')
if [ "$type" != "xray" ]; then [ "$type" != "xray" ] && [ -n "$XRAY_BIN" ] && type="xray"
bin=$(first_type $(config_t_get global_app xray_file) xray)
[ -n "$bin" ] && type="xray"
fi
} }
[ -z "$type" ] && return 1 [ -z "$type" ] && return 1
json_init json_init
@@ -279,7 +275,7 @@ run_xray() {
[ -n "$no_run" ] && json_add_string "no_run" "1" [ -n "$no_run" ] && json_add_string "no_run" "1"
local _json_arg="$(json_dump)" local _json_arg="$(json_dump)"
lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file
[ -n "$no_run" ] || ln_run "$(first_type $(config_t_get global_app ${type}_file) ${type})" ${type} $log_file run -c "$config_file" [ -n "$no_run" ] || ln_run "$XRAY_BIN" "xray" $log_file run -c "$config_file"
} }
run_dns2socks() { run_dns2socks() {
@@ -409,19 +405,20 @@ run_socks() {
json_add_string "server_port" "${_socks_port}" json_add_string "server_port" "${_socks_port}"
json_add_string "server_username" "${_socks_username}" json_add_string "server_username" "${_socks_username}"
json_add_string "server_password" "${_socks_password}" json_add_string "server_password" "${_socks_password}"
local bin=$(first_type $(config_t_get global_app sing_box_file) sing-box) if [ -n "${SINGBOX_BIN}" ]; then
if [ -n "$bin" ]; then
type="sing-box" type="sing-box"
lua $UTIL_SINGBOX gen_proto_config "$(json_dump)" > $config_file local bin="${SINGBOX_BIN}"
ln_run "$bin" ${type} $log_file run -c "$config_file" local util="${UTIL_SINGBOX}"
else elif [ -n "${XRAY_BIN}" ]; then
bin=$(first_type $(config_t_get global_app xray_file) xray) type="xray"
[ -n "$bin" ] && { local bin="${XRAY_BIN}"
type="xray" local util="${UTIL_XRAY}"
lua $UTIL_XRAY gen_proto_config "$(json_dump)" > $config_file
ln_run "$bin" ${type} $log_file run -c "$config_file"
}
fi fi
[ -n "${bin}" ] && [ -n "${util}" ] && {
lua ${util} gen_proto_config "$(json_dump)" > $config_file
[ -n "$no_run" ] || ln_run "$bin" $type $log_file run -c "$config_file"
}
unset bin util
;; ;;
sing-box) sing-box)
[ "$http_port" != "0" ] && { [ "$http_port" != "0" ] && {
@@ -514,10 +511,7 @@ run_socks() {
# http to socks # http to socks
[ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && { [ -z "$http_flag" ] && [ "$http_port" != "0" ] && [ -n "$http_config_file" ] && [ "$type" != "sing-box" ] && [ "$type" != "xray" ] && [ "$type" != "socks" ] && {
local bin=$(first_type $(config_t_get global_app sing_box_file) sing-box) json_init
json_add_null "node"
json_add_null "server_host"
json_add_null "server_port"
json_add_string "local_http_address" "$bind" json_add_string "local_http_address" "$bind"
json_add_string "local_http_port" "$http_port" json_add_string "local_http_port" "$http_port"
json_add_string "server_proto" "socks" json_add_string "server_proto" "socks"
@@ -525,17 +519,20 @@ run_socks() {
json_add_string "server_port" "$socks_port" json_add_string "server_port" "$socks_port"
json_add_string "server_username" "$_username" json_add_string "server_username" "$_username"
json_add_string "server_password" "$_password" json_add_string "server_password" "$_password"
if [ -n "$bin" ]; then if [ -n "${SINGBOX_BIN}" ]; then
type="sing-box" type="sing-box"
lua $UTIL_SINGBOX gen_proto_config "$(json_dump)" > $http_config_file local bin="${SINGBOX_BIN}"
[ -n "$no_run" ] || ln_run "$bin" ${type} /dev/null run -c "$http_config_file" local util="${UTIL_SINGBOX}"
else elif [ -n "${XRAY_BIN}" ]; then
bin=$(first_type $(config_t_get global_app xray_file) xray) type="xray"
[ -n "$bin" ] && type="xray" local bin="${XRAY_BIN}"
[ -z "$type" ] && return 1 local util="${UTIL_XRAY}"
lua $UTIL_XRAY gen_proto_config "$(json_dump)" > $http_config_file
[ -n "$no_run" ] || ln_run "$bin" ${type} /dev/null run -c "$http_config_file"
fi fi
[ -n "${bin}" ] && [ -n "${util}" ] && {
lua ${util} gen_proto_config "$(json_dump)" > $http_config_file
[ -n "$no_run" ] || ln_run "$bin" $type /dev/null run -c "$http_config_file"
}
unset bin util
} }
unset http_flag unset http_flag