mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-02 03:33:56 +08:00
update 2026-10-31 18:07:25
This commit is contained in:
1 parent
6ce64f7ba2
commit
04b58d28a1
70 files changed
+209
-211
No files matched your search
@@ -1088,7 +1088,7 @@ start_dns() {
|
||||
local ACL_RULE_DNSMASQ=0
|
||||
for acl_section in $(uci show ${CONFIG} | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
|
||||
if [ "$(config_n_get $acl_section enabled)" = "1" ] && \
|
||||
[ "$(config_n_get $acl_section dns_shunt)" = "dnsmasq" ]; then
|
||||
[ "$(config_n_get $acl_section dns_shunt)" = "dnsmasq" ]; then
|
||||
ACL_RULE_DNSMASQ=1
|
||||
break
|
||||
fi
|
||||
@@ -1101,7 +1101,7 @@ start_dns() {
|
||||
china_ng_local_dns=${LOCAL_DNS}
|
||||
v2ray_local_dns="direct_dns_udp_server=${LOCAL_DNS}"
|
||||
;;
|
||||
tcp)
|
||||
tcp)
|
||||
local DIRECT_DNS=$(normalize_dns "$(config_n_get @global[0] direct_dns 223.5.5.5:53)")
|
||||
china_ng_local_dns="tcp://${DIRECT_DNS}"
|
||||
v2ray_local_dns="direct_dns_tcp_server=${DIRECT_DNS}"
|
||||
|
||||
@@ -625,7 +625,7 @@ local function encode_node(node)
|
||||
end
|
||||
|
||||
function parseClashNode(raw, remark)
|
||||
if not raw then return "" end
|
||||
if not raw then return "" end
|
||||
domain_redir = {}
|
||||
local ok, lyaml = pcall(require, "lyaml")
|
||||
if not ok then return raw end
|
||||
|
||||
@@ -605,7 +605,7 @@ if CHNLIST == "proxy" then DEFAULT_TAG = "chn" end
|
||||
--全局模式,默认使用远程DNS
|
||||
if only_global then
|
||||
DEFAULT_TAG = "gfw"
|
||||
if NO_IPV6_TRUST == "1" and not IS_SHUNT_NODE then
|
||||
if NO_IPV6_TRUST == "1" and not IS_SHUNT_NODE then
|
||||
table.insert(config_lines, "no-ipv6")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -761,7 +761,7 @@ function add_rule(var)
|
||||
server_out:close()
|
||||
ipset_out:close()
|
||||
end
|
||||
|
||||
|
||||
if not GEO_SUCCESS then new_text = "" end
|
||||
local f_out = io.open(CACHE_TEXT_FILE, "a")
|
||||
f_out:write(new_text)
|
||||
|
||||
@@ -172,9 +172,7 @@ local auto_config_lines = {}
|
||||
-- 直连规则显式覆盖远程兜底的缓存、IPv6、测速和双栈优选设置。
|
||||
local DIRECT_RULE_OPTIONS = " -enable-cache -address -6 -speed-check-mode ping,tcp:80,tcp:443 -response-mode first-ping -d yes"
|
||||
--设置默认 DNS 分组(兜底组),全局代理模式仍使用远程组。
|
||||
local DEFAULT_DNS_GROUP = (USE_DEFAULT_DNS == "direct" and "direct") or
|
||||
(USE_DEFAULT_DNS == "remote" and "proxy") or
|
||||
(USE_DEFAULT_DNS == "auto" and AUTO_GROUP)
|
||||
local DEFAULT_DNS_GROUP = (USE_DEFAULT_DNS == "direct" and "direct") or (USE_DEFAULT_DNS == "remote" and "proxy") or (USE_DEFAULT_DNS == "auto" and AUTO_GROUP)
|
||||
local only_global = (DEFAULT_PROXY_MODE == "proxy" and CHN_LIST == "0" and USE_GFW_LIST == "0") and 1
|
||||
if only_global == 1 then
|
||||
DEFAULT_DNS_GROUP = "proxy"
|
||||
|
||||
@@ -817,7 +817,7 @@ filter_node() {
|
||||
local address=$(config_n_get "$node" address)
|
||||
local port=$(config_n_get "$node" port)
|
||||
local hop=$(config_n_get "$node" hysteria2_hop)
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -z "$address" ] && return 1
|
||||
echo "$address" | grep -Eq "$EXCLUDE_VPSIP" && return 1
|
||||
[ -z "$port" ] && return 1
|
||||
|
||||
@@ -197,20 +197,20 @@ insert_nftset() {
|
||||
RS = "[ \t\n\r]+"
|
||||
ORS = ""
|
||||
}
|
||||
$0 != "" {
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
$0 != "" {
|
||||
if (!first) {
|
||||
printf "add element %s %s { \n", t, n
|
||||
first = 1
|
||||
} else {
|
||||
print ",\n"
|
||||
}
|
||||
printf " %s", $0
|
||||
}
|
||||
END {
|
||||
if (first) {
|
||||
print "\n }\n"
|
||||
}
|
||||
}' | nft -f -
|
||||
} else {
|
||||
print ",\n"
|
||||
}
|
||||
printf " %s", $0
|
||||
}
|
||||
END {
|
||||
if (first) {
|
||||
print "\n }\n"
|
||||
}
|
||||
}' | nft -f -
|
||||
}
|
||||
|
||||
gen_nftset() {
|
||||
@@ -300,7 +300,7 @@ load_acl() {
|
||||
use_shunt_node=0
|
||||
[ -n "$node" ] && [ "$(config_n_get $node protocol)" = "_shunt" ] && use_shunt_node=1
|
||||
|
||||
[ "${use_global_config}" = "1" ] && {
|
||||
[ "${use_global_config}" = "1" ] && {
|
||||
if [ "$(config_get_type $NODE)" = "socks" ]; then
|
||||
node_remark="Socks 配置($(config_n_get $NODE port) 端口)"
|
||||
else
|
||||
@@ -856,7 +856,7 @@ filter_node() {
|
||||
local address=$(config_n_get "$node" address)
|
||||
local port=$(config_n_get "$node" port)
|
||||
local hop=$(config_n_get "$node" hysteria2_hop)
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -n "$hop" ] && port="${port:+$port,}$hop"
|
||||
[ -z "$address" ] && return 1
|
||||
echo "$address" | grep -Eq "$EXCLUDE_VPSIP" && return 1
|
||||
[ -z "$port" ] && return 1
|
||||
@@ -954,7 +954,7 @@ add_firewall_rule() {
|
||||
add_script_mwan3
|
||||
mwan3_start
|
||||
set_tproxy_sysctl
|
||||
gen_nftset $NFTSET_WAN ipv4_addr 0
|
||||
gen_nftset $NFTSET_WAN ipv4_addr 0
|
||||
gen_nftset $NFTSET_VPS ipv4_addr 0
|
||||
gen_nftset $NFTSET_GFW ipv4_addr "2d"
|
||||
gen_nftset $NFTSET_LOCAL ipv4_addr 0
|
||||
@@ -976,7 +976,7 @@ add_firewall_rule() {
|
||||
gen_nftset $NFTSET_SHUNT ipv4_addr "2d"
|
||||
gen_nftset $NFTSET_SHUNT_STATIC ipv4_addr 0
|
||||
|
||||
gen_nftset $NFTSET_WAN6 ipv6_addr 0
|
||||
gen_nftset $NFTSET_WAN6 ipv6_addr 0
|
||||
gen_nftset $NFTSET_VPS6 ipv6_addr 0
|
||||
gen_nftset $NFTSET_GFW6 ipv6_addr "2d"
|
||||
gen_nftset $NFTSET_LOCAL6 ipv6_addr 0
|
||||
@@ -1502,7 +1502,7 @@ add_firewall_rule() {
|
||||
|
||||
del_firewall_rule() {
|
||||
for nft in "dstnat" "srcnat" "nat_output" "mangle_prerouting" "mangle_output"; do
|
||||
local handles=$(nft -a list chain $NFTABLE_NAME ${nft} 2>/dev/null | grep -E "PSW_" | awk -F '# handle ' '{print$2}')
|
||||
local handles=$(nft -a list chain $NFTABLE_NAME ${nft} 2>/dev/null | grep -E "PSW_" | awk -F '# handle ' '{print$2}')
|
||||
for handle in $handles; do
|
||||
nft delete rule $NFTABLE_NAME ${nft} handle ${handle} 2>/dev/null
|
||||
done
|
||||
|
||||
@@ -345,7 +345,7 @@ local function extract_domain(s)
|
||||
local last_dot = nil
|
||||
for i = 1, len do
|
||||
local b = s:byte(i)
|
||||
-- 允许的域名字符:a-zA-Z0-9.-
|
||||
-- 允许的域名字符:a-zA-Z0-9.-
|
||||
if (b >= 48 and b <= 57) or (b >= 65 and b <= 90) or (b >= 97 and b <= 122) or b == 45 or b == 46 then
|
||||
if not start then start = i end
|
||||
if b == 46 then last_dot = i end
|
||||
|
||||
@@ -608,7 +608,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
result.protocol = hostInfo[#hostInfo-3]
|
||||
result.method = hostInfo[#hostInfo-2]
|
||||
result.obfs = hostInfo[#hostInfo-1]
|
||||
result.password = base64Decode(hostInfo[#hostInfo])
|
||||
result.password = base64Decode(hostInfo[#hostInfo])
|
||||
local params = {}
|
||||
for _, v in pairs(split(dat[2], '&')) do
|
||||
local s = v:find("=", 1, true)
|
||||
@@ -695,7 +695,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if not info.net then info.net = "tcp" end
|
||||
info.net = string.lower(info.net)
|
||||
if result.type == "sing-box" and info.net == "raw" then
|
||||
if result.type == "sing-box" and info.net == "raw" then
|
||||
info.net = "tcp"
|
||||
elseif result.type == "Xray" and info.net == "tcp" then
|
||||
info.net = "raw"
|
||||
@@ -962,7 +962,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if params.type then
|
||||
params.type = string.lower(params.type)
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -1175,7 +1175,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
|
||||
if not params.type then params.type = "tcp" end
|
||||
params.type = string.lower(params.type)
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -1302,7 +1302,7 @@ local function processData(szType, content, add_mode, group, sub_cfg)
|
||||
if ({ xhttp=true, kcp=true, mkcp=true })[params.type] and result.type ~= "Xray" and has_xray then
|
||||
result.type = "Xray"
|
||||
end
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
if result.type == "sing-box" and params.type == "raw" then
|
||||
params.type = "tcp"
|
||||
elseif result.type == "Xray" and params.type == "tcp" then
|
||||
params.type = "raw"
|
||||
@@ -2117,7 +2117,7 @@ local function update_node(manual)
|
||||
uci_set(cfgid, "chain_proxy", "3")
|
||||
uci_set(cfgid, "outbound_iface", outbound_iface_group)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user