1 Commits
Author SHA1 Message Date
mack-a c15f06d211 fix(订阅): 修复 sing-box Reality 端口变量拼接问题
fix(sing-box): 修复订阅无法使用问题
2026-09-02 04:19:40 +08:00
3 changed files with 47 additions and 51 deletions
+5 -45
View File
@@ -30,8 +30,7 @@
"server": "1.1.1.1", "server": "1.1.1.1",
"server_port": 443, "server_port": 443,
"detour": "自动选择", "detour": "自动选择",
"path": "/dns-query", "path": "/dns-query"
"domain_resolver": "dns_resolver"
}, },
{ {
"tag": "dns_direct", "tag": "dns_direct",
@@ -39,18 +38,12 @@
"server": "dns.alidns.com", "server": "dns.alidns.com",
"server_port": 443, "server_port": 443,
"path": "/dns-query", "path": "/dns-query",
"domain_resolver": "dns_resolver" "domain_resolver": "local"
}, },
{ {
"tag": "google", "tag": "google",
"type": "tls", "type": "tls",
"server": "8.8.4.4", "server": "8.8.4.4"
"domain_resolver": "dns_resolver"
},
{
"tag": "dns_resolver",
"type": "udp",
"server": "114.114.114.114"
}, },
{ {
"type": "local", "type": "local",
@@ -83,30 +76,6 @@
"final": "dns_direct" "final": "dns_direct"
}, },
"inbounds": [ "inbounds": [
{
"type": "tun",
"tag": "tun-in",
"stack": "system",
"address": [
"172.18.0.1/30",
"fdfe:dcba:9876::1/126"
],
"route_address": [
"0.0.0.0/1",
"128.0.0.0/1",
"::/1",
"8000::/1"
],
"route_exclude_address": [
"192.168.0.0/16",
"10.0.0.0/8",
"172.16.0.0/12",
"fc00::/7"
],
"mtu": 9000,
"auto_route": true,
"strict_route": true
},
{ {
"type": "mixed", "type": "mixed",
"tag": "mixed-in", "tag": "mixed-in",
@@ -216,10 +185,7 @@
], ],
"route": { "route": {
"default_http_client": "rule_set_http", "default_http_client": "rule_set_http",
"default_domain_resolver": { "default_domain_resolver": "local",
"server": "dns_resolver",
"strategy": "prefer_ipv4"
},
"rule_set": [ "rule_set": [
{ {
"tag": "geosite-category-ads-all", "tag": "geosite-category-ads-all",
@@ -354,11 +320,6 @@
"action": "sniff", "action": "sniff",
"timeout": "1s" "timeout": "1s"
}, },
{
"inbound": "tun-in",
"action": "sniff",
"timeout": "1s"
},
{ {
"protocol": "dns", "protocol": "dns",
"action": "hijack-dns" "action": "hijack-dns"
@@ -460,7 +421,6 @@
"outbound": "本地直连" "outbound": "本地直连"
} }
], ],
"final": "本地直连", "final": "本地直连"
"auto_detect_interface": true
} }
} }
+22 -4
View File
@@ -200,6 +200,7 @@ initVar() {
# xray-core reality serverName publicKey # xray-core reality serverName publicKey
xrayVLESSRealityServerName= xrayVLESSRealityServerName=
xrayVLESSRealityPort= xrayVLESSRealityPort=
xrayVLESSRealityVisionPort=
xrayVLESSRealityXHTTPServerName= xrayVLESSRealityXHTTPServerName=
xrayVLESSRealityXHTTPort= xrayVLESSRealityXHTTPort=
# xrayVLESSRealityPublicKey= # xrayVLESSRealityPublicKey=
@@ -425,6 +426,7 @@ readInstallProtocolType() {
frontingType= frontingType=
xrayVLESSRealityPort= xrayVLESSRealityPort=
xrayVLESSRealityVisionPort=
xrayVLESSRealityServerName= xrayVLESSRealityServerName=
xrayVLESSRealityXHTTPort= xrayVLESSRealityXHTTPort=
@@ -5233,6 +5235,20 @@ EOF
} }
# 获取Reality订阅端口
getRealitySubscriptionPort() {
local protocol=$1
if [[ "${coreInstallType}" == "2" ]]; then
if [[ "${protocol}" == "grpc" ]]; then
printf '%s\n' "${singBoxVLESSRealityGRPCPort}"
else
printf '%s\n' "${singBoxVLESSRealityVisionPort}"
fi
else
printf '%s\n' "${xrayVLESSRealityVisionPort}"
fi
}
# 账号 # 账号
showAccounts() { showAccounts() {
readInstallType readInstallType
@@ -5401,7 +5417,7 @@ showAccounts() {
echoContent skyBlue "\n ---> 账号:${email}" echoContent skyBlue "\n ---> 账号:${email}"
echo echo
defaultBase64Code vlessReality "${xrayVLESSRealityVisionPort}${singBoxVLESSRealityVisionPort}" "${email}" "$(echo "${user}" | jq -r .id//.uuid)" defaultBase64Code vlessReality "$(getRealitySubscriptionPort vision)" "${email}" "$(echo "${user}" | jq -r .id//.uuid)"
done done
fi fi
# VLESS reality gRPC # VLESS reality gRPC
@@ -5413,7 +5429,7 @@ showAccounts() {
echoContent skyBlue "\n ---> 账号:${email}" echoContent skyBlue "\n ---> 账号:${email}"
echo echo
defaultBase64Code vlessRealityGRPC "${xrayVLESSRealityVisionPort}${singBoxVLESSRealityGRPCPort}" "${email}" "$(echo "${user}" | jq -r .id//.uuid)" defaultBase64Code vlessRealityGRPC "$(getRealitySubscriptionPort grpc)" "${email}" "$(echo "${user}" | jq -r .id//.uuid)"
done done
fi fi
# tuic # tuic
@@ -9638,7 +9654,7 @@ checkRealityDest() {
local traceResult= local traceResult=
traceResult=$(curl -s "https://$(echo "${realityDestDomain}" | cut -d ':' -f 1)/cdn-cgi/trace" | grep "visit_scheme=https") traceResult=$(curl -s "https://$(echo "${realityDestDomain}" | cut -d ':' -f 1)/cdn-cgi/trace" | grep "visit_scheme=https")
if [[ -n "${traceResult}" ]]; then if [[ -n "${traceResult}" ]]; then
echoContent red "\n ---> 检测到使用的域名,托管在cloudflare并开启了代理,使用此类型域名可能导致VPS流量被他人使用[不建议使用]\n" echoContent red "\n ---> 禁止使用已启用 Cloudflare 代理的域名。强制使用将导致 VPS 流量被他人滥用,相关后果由您自行承担。\n"
read -r -p "是否继续 [y/n]" setRealityDestStatus read -r -p "是否继续 [y/n]" setRealityDestStatus
if [[ "${setRealityDestStatus}" != 'y' ]]; then if [[ "${setRealityDestStatus}" != 'y' ]]; then
exit 0 exit 0
@@ -9719,6 +9735,8 @@ initRealityClientServersName() {
fi fi
fi fi
realityDestDomain="${realityServerName}:${realityDomainPort}"
checkRealityDest
echoContent yellow "\n ---> 客户端可用域名: ${realityServerName}:${realityDomainPort}\n" echoContent yellow "\n ---> 客户端可用域名: ${realityServerName}:${realityDomainPort}\n"
} }
# 初始化reality端口 # 初始化reality端口
@@ -9996,7 +10014,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者:mack-a" echoContent green "作者:mack-a"
echoContent green "当前版本:v3.5.21" echoContent green "当前版本:v3.5.22"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus
+20 -2
View File
@@ -204,6 +204,7 @@ initVar() {
# xray-core reality serverName publicKey # xray-core reality serverName publicKey
xrayVLESSRealityServerName= xrayVLESSRealityServerName=
xrayVLESSRealityPort= xrayVLESSRealityPort=
xrayVLESSRealityVisionPort=
xrayVLESSRealityXHTTPServerName= xrayVLESSRealityXHTTPServerName=
xrayVLESSRealityXHTTPort= xrayVLESSRealityXHTTPort=
# xrayVLESSRealityPublicKey= # xrayVLESSRealityPublicKey=
@@ -431,6 +432,7 @@ readInstallProtocolType() {
frontingType= frontingType=
xrayVLESSRealityPort= xrayVLESSRealityPort=
xrayVLESSRealityVisionPort=
xrayVLESSRealityServerName= xrayVLESSRealityServerName=
xrayVLESSRealityXHTTPort= xrayVLESSRealityXHTTPort=
@@ -5193,6 +5195,20 @@ EOF
} }
# Get Reality subscription port
getRealitySubscriptionPort() {
local protocol=$1
if [[ "${coreInstallType}" == "2" ]]; then
if [[ "${protocol}" == "grpc" ]]; then
printf '%s\n' "${singBoxVLESSRealityGRPCPort}"
else
printf '%s\n' "${singBoxVLESSRealityVisionPort}"
fi
else
printf '%s\n' "${xrayVLESSRealityVisionPort}"
fi
}
# account # account
showAccounts() { showAccounts() {
readInstallType readInstallType
@@ -5361,7 +5377,7 @@ showAccounts() {
echoContent skyBlue "\n --->Account:${email}" echoContent skyBlue "\n --->Account:${email}"
echo echo
defaultBase64Code vlessReality "${xrayVLESSRealityVisionPort}${singBoxVLESSRealityVisionPort}" "${email}" "$(echo "${user}" | jq -r .id//.uuid)" defaultBase64Code vlessReality "$(getRealitySubscriptionPort vision)" "${email}" "$(echo "${user}" | jq -r .id//.uuid)"
done done
fi fi
# VLESS reality gRPC # VLESS reality gRPC
@@ -5373,7 +5389,7 @@ showAccounts() {
echoContent skyBlue "\n --->Account:${email}" echoContent skyBlue "\n --->Account:${email}"
echo echo
defaultBase64Code vlessRealityGRPC "${xrayVLESSRealityVisionPort}${singBoxVLESSRealityGRPCPort}" "${email}" "$(echo "${user}" | jq -r .id//.uuid)" defaultBase64Code vlessRealityGRPC "$(getRealitySubscriptionPort grpc)" "${email}" "$(echo "${user}" | jq -r .id//.uuid)"
done done
fi fi
# tuic # tuic
@@ -9650,6 +9666,8 @@ initRealityClientServersName() {
fi fi
fi fi
realityDestDomain="${realityServerName}:${realityDomainPort}"
checkRealityDest
echoContent yellow "Online QR code: https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/clashMetaProfiles/${emailMd5}\n " echoContent yellow "Online QR code: https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/clashMetaProfiles/${emailMd5}\n "
} }
initXrayRealityPort() { initXrayRealityPort() {