@@ -7659,6 +7659,7 @@ sniRouting() {
76597659 echoContent red " \n=============================================================="
76607660 echoContent yellow " # 注意事项"
76617661 echoContent yellow " # 使用教程:https://www.v2ray-agent.com/archives/1683226921000 \n"
7662+ echoContent yellow " # sing-box不支持规则集,仅支持指定域名。\n"
76627663
76637664 echoContent yellow " 1.添加"
76647665 echoContent yellow " 2.卸载"
@@ -7678,14 +7679,14 @@ setUnlockSNI() {
76787679 read -r -p " 请输入分流的SNI IP:" setSNIP
76797680 if [[ -n ${setSNIP} ]]; then
76807681 echoContent red " =============================================================="
7681- echoContent yellow " 录入示例:netflix,disney,hulu"
7682- read -r -p " 请按照上面示例录入域名:" domainList
76837682
7684- if [[ -n " ${domainList} " ]]; then
7683+ if [[ " ${coreInstallType} " == 1 ]]; then
7684+ echoContent yellow " 录入示例:netflix,disney,hulu"
7685+ read -r -p " 请按照上面示例录入域名:" xrayDomainList
76857686 local hosts={}
76867687 while read -r domain; do
76877688 hosts=$( echo " ${hosts} " | jq -r " .\" geosite:${domain} \" =\" ${setSNIP} \" " )
7688- done < <( echo " ${domainList } " | tr ' ,' ' \n' )
7689+ done < <( echo " ${xrayDomainList } " | tr ' ,' ' \n' )
76897690 cat << EOF >${configPath} 11_dns.json
76907691{
76917692 "dns": {
@@ -7697,14 +7698,15 @@ setUnlockSNI() {
76977698 }
76987699}
76997700EOF
7700- echoContent red " ---> SNI反向代理分流成功"
7701- reloadCore
7702- else
7703- echoContent red " ---> 域名不可为空"
77047701 fi
7705-
7702+ if [[ -n " ${singBoxConfigPath} " ]]; then
7703+ echoContent yellow " 录入示例:www.netflix.com,www.google.com"
7704+ read -r -p " 请按照上面示例录入域名:" singboxDomainList
7705+ addSingBoxDNSConfig " ${setSNIP} " " ${singboxDomainList} " " predefined"
7706+ fi
7707+ echoContent yellow " ---> SNI反向代理分流成功"
7708+ reloadCore
77067709 else
7707-
77087710 echoContent red " ---> SNI IP不可为空"
77097711 fi
77107712 exit 0
@@ -7749,6 +7751,7 @@ EOF
77497751addSingBoxDNSConfig () {
77507752 local ip=$1
77517753 local domainList=$2
7754+ local actionType=$3
77527755
77537756 local rules=
77547757 rules=$( initSingBoxRules " ${domainList} " " dns" )
@@ -7766,17 +7769,48 @@ addSingBoxDNSConfig() {
77667769 ruleSetTag=$( echo " ${ruleSet} " | jq ' .|map(.tag)' )
77677770 fi
77687771 if [[ -n " ${singBoxConfigPath} " ]]; then
7769- cat << EOF >"${singBoxConfigPath} dns.json"
7772+ if [[ " ${actionType} " == " predefined" ]]; then
7773+ local predefined={}
7774+ while read -r line; do
7775+ predefined=$( echo " ${predefined} " | jq " .\" ${line} \" =\" ${ip} \" " )
7776+ done < <( echo " ${domainList} " | tr ' ,' ' \n' | grep -v ' ^$' | sort -n | uniq | paste -sd ' ,' | tr ' ,' ' \n' )
7777+
7778+ cat << EOF >"${singBoxConfigPath} dns.json"
7779+ {
7780+ "dns": {
7781+ "servers": [
7782+ {
7783+ "tag": "local",
7784+ "type": "local"
7785+ },
7786+ {
7787+ "tag": "hosts",
7788+ "type": "hosts",
7789+ "predefined": ${predefined}
7790+ }
7791+ ],
7792+ "rules": [
7793+ {
7794+ "domain_regex":${domainRules} ,
7795+ "server":"hosts"
7796+ }
7797+ ]
7798+ }
7799+ }
7800+ EOF
7801+ else
7802+ cat << EOF >"${singBoxConfigPath} dns.json"
77707803{
77717804 "dns": {
77727805 "servers": [
77737806 {
77747807 "tag": "local",
7775- "address ": "local"
7808+ "type ": "local"
77767809 },
77777810 {
77787811 "tag": "dnsRouting",
7779- "address": "${ip} "
7812+ "type": "udp",
7813+ "server": "${ip} "
77807814 }
77817815 ],
77827816 "rules": [
@@ -7792,6 +7826,7 @@ addSingBoxDNSConfig() {
77927826 }
77937827}
77947828EOF
7829+ fi
77957830 fi
77967831}
77977832# 设置dns
@@ -7842,7 +7877,7 @@ EOF
78427877 "dns": {
78437878 "servers":[
78447879 {
7845- "address ":"local"
7880+ "type ":"local"
78467881 }
78477882 ]
78487883 }
@@ -7859,17 +7894,33 @@ EOF
78597894
78607895# 移除SNI分流
78617896removeUnlockSNI () {
7862- cat << EOF >${configPath} 11_dns.json
7897+ if [[ " ${coreInstallType} " == 1 ]]; then
7898+ cat << EOF >${configPath} 11_dns.json
78637899{
7864- "dns": {
7865- "servers": [
7866- "localhost"
7867- ]
7868- }
7900+ "dns": {
7901+ "servers": [
7902+ "localhost"
7903+ ]
7904+ }
78697905}
78707906EOF
7871- reloadCore
7907+ fi
78727908
7909+ if [[ " ${coreInstallType} " == " 2" && -f " ${singBoxConfigPath} dns.json" ]]; then
7910+ cat << EOF >${singBoxConfigPath} dns.json
7911+ {
7912+ "dns": {
7913+ "servers":[
7914+ {
7915+ "type":"local"
7916+ }
7917+ ]
7918+ }
7919+ }
7920+ EOF
7921+ fi
7922+
7923+ reloadCore
78737924 echoContent green " ---> 卸载成功"
78747925
78757926 exit 0
@@ -8484,6 +8535,7 @@ proxy-groups:
84848535 - ${subscribeSalt} _provider
84858536 proxies:
84868537 - 自动选择
8538+ - 手动切换
84878539 - DIRECT
84888540
84898541 - name: Telegram
@@ -8538,21 +8590,26 @@ proxy-groups:
85388590 use:
85398591 - ${subscribeSalt} _provider
85408592 proxies:
8593+ - 手动切换
85418594 - 自动选择
8595+
8596+
85428597 - name: OpenAI
85438598 type: select
85448599 use:
85458600 - ${subscribeSalt} _provider
85468601 proxies:
8547- - 自动选择
85488602 - 手动切换
8603+ - 自动选择
8604+
85498605 - name: ClaudeAI
85508606 type: select
85518607 use:
85528608 - ${subscribeSalt} _provider
85538609 proxies:
8554- - 自动选择
85558610 - 手动切换
8611+ - 自动选择
8612+
85568613 - name: Disney
85578614 type: select
85588615 use:
@@ -9432,17 +9489,20 @@ menu() {
94329489 cd " $HOME " || exit
94339490 echoContent red " \n=============================================================="
94349491 echoContent green " 作者:mack-a"
9435- echoContent green " 当前版本:v3.4.30 "
9492+ echoContent green " 当前版本:v3.4.31 "
94369493 echoContent green " Github:https://github.com/mack-a/v2ray-agent"
94379494 echoContent green " 描述:八合一共存脚本\c"
94389495 showInstallStatus
94399496 checkWgetShowProgress
94409497 echoContent red " \n=========================== 推广区============================"
94419498 echoContent red " "
9442- echoContent green " VPS选购攻略:https://www.v2ray-agent.com/archives/1679975663984"
9443- echoContent green " 年付10美金低价VPS AS4837:https://www.v2ray-agent.com/archives/racknerdtao-can-zheng-li-nian-fu-10mei-yuan"
9444- echoContent green " 优质常驻套餐DMIT CN2-GIA:https://www.v2ray-agent.com/archives/186cee7b-9459-4e57-b9b2-b07a4f36931c"
9445- echoContent green " VPS探针:https://ping.v2ray-agent.com/"
9499+ echoContent yellow " VPS选购攻略"
9500+ echoContent green " https://www.v2ray-agent.com/archives/1679975663984"
9501+ echoContent yellow " 年付10美金低价VPS AS4837"
9502+ echoContent green " https://www.v2ray-agent.com/archives/racknerdtao-can-zheng-li-nian-fu-10mei-yuan"
9503+ echoContent yellow " 优质常驻套餐DMIT CN2-GIA"
9504+ echoContent green " https://www.v2ray-agent.com/archives/186cee7b-9459-4e57-b9b2-b07a4f36931c"
9505+ echoContent yellow " VPS探针:https://ping.v2ray-agent.com/"
94469506 echoContent red " =============================================================="
94479507 if [[ -n " ${coreInstallType} " ]]; then
94489508 echoContent yellow " 1.重新安装"
0 commit comments