3 Commits

Author SHA1 Message Date
mack-a 090990d93c feat(脚本): DNSAPI 申请证书时默认申请主域名 2025-05-14 16:08:19 +08:00
mack-a 7eef0d1e5c feat(脚本): 修复warp问题、修改系统判断 2025-05-12 16:39:27 +08:00
mack-a 4f4d441919 feat(脚本): 恢复singbox配置 2025-05-08 12:13:35 +08:00
3 changed files with 136 additions and 168 deletions
+1 -1
View File
@@ -12,4 +12,4 @@ apt update && apt install wget curl -y
- Ubuntu
```
apt-get update && apt-get install wget -y
```
```
+19 -23
View File
@@ -20,36 +20,38 @@
"servers": [
{
"tag": "dns_proxy",
"type": "https",
"server": "1.1.1.1",
"server_port": 443,
"path": "/dns-query",
"domain_resolver": "dns_resolver",
"strategy": "prefer_ipv4"
"address": "https://1.1.1.1/dns-query",
"address_resolver": "dns_resolver",
"strategy": "ipv4_only",
"detour": "手动切换"
},
{
"tag": "dns_direct",
"type": "h3",
"server": "dns.alidns.com",
"server_port": 443,
"path": "/dns-query",
"domain_resolver": "dns_resolver",
"strategy": "prefer_ipv4"
"address": "h3://dns.alidns.com/dns-query",
"address_resolver": "dns_resolver",
"strategy": "ipv4_only",
"detour": "direct"
},
{
"tag": "google",
"type": "tls",
"server": "8.8.4.4",
"domain_resolver": "dns_resolver",
"strategy": "prefer_ipv4"
"address": "tls://8.8.4.4"
},
{
"tag": "dns_block",
"address": "rcode://success"
},
{
"tag": "dns_resolver",
"address": "114.114.114.114",
"strategy": "prefer_ipv4"
"strategy": "ipv4_only",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "dns_direct"
},
{
"clash_mode": "direct",
"server": "dns_direct"
@@ -110,12 +112,6 @@
}
],
"outbounds": [
{
"domain_resolver": {
"server": "dns_direct",
"strategy": "prefer_ipv4"
}
},
{
"type": "urltest",
"tag": "自动选择",
+116 -144
View File
@@ -58,14 +58,14 @@ checkSystem() {
removeType='yum -y remove'
upgrade="yum update -y --skip-broken"
checkCentosSELinux
elif [[ -f "/etc/issue" ]] && grep </etc/issue -q -i "debian" || [[ -f "/proc/version" ]] && grep </etc/issue -q -i "debian" || [[ -f "/etc/os-release" ]] && grep </etc/os-release -q -i "ID=debian"; then
elif { [[ -f "/etc/issue" ]] && grep -qi "debian" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "debian" /proc/version;} || { [[ -f "/etc/os-release" ]] && grep -qi "ID=debian" /etc/issue; }; then
release="debian"
installType='apt -y install'
upgrade="apt update"
updateReleaseInfoChange='apt-get --allow-releaseinfo-change update'
removeType='apt -y autoremove'
elif [[ -f "/etc/issue" ]] && grep </etc/issue -q -i "ubuntu" || [[ -f "/proc/version" ]] && grep </etc/issue -q -i "ubuntu"; then
elif { [[ -f "/etc/issue" ]] && grep -qi "ubuntu" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "ubuntu" /proc/version; }; then
release="ubuntu"
installType='apt -y install'
upgrade="apt update"
@@ -74,11 +74,11 @@ checkSystem() {
if grep </etc/issue -q -i "16."; then
release=
fi
elif [[ -f "/etc/issue" ]] && grep </etc/issue -q -i "Alpine" || [[ -f "/proc/version" ]] && grep </proc/version -q -i "Alpine"; then
elif { [[ -f "/etc/issue" ]] && grep -qi "Alpine" /etc/issue; } || { [[ -f "/proc/version" ]] && grep -qi "Alpine" /proc/version; }; then
release="alpine"
installType='apk add'
upgrade="apk update"
removeType='apt del'
removeType='apk del'
nginxConfigPath=/etc/nginx/http.d/
fi
@@ -1743,12 +1743,8 @@ initDNSAPIConfig() {
exit 0
fi
read -r -p "是否使用*.${dnsTLSDomain}进行API申请通配符证书?[y/n]:" dnsAPIStatus
# if [[ "${dnsAPIStatus}" != "y" ]]; then
# exit 0
# fi
fi
elif [[ "$1" == "aliyun" ]]; then
# echoContent yellow "\n CF_Token参考配置教程:https://www.v2ray-agent.com/archives/1701160377972\n"
read -r -p "请输入Ali Key:" aliKey
read -r -p "请输入Ali Secret:" aliSecret
if [[ -z "${aliKey}" || -z "${aliSecret}" ]]; then
@@ -1761,9 +1757,6 @@ initDNSAPIConfig() {
exit 0
fi
read -r -p "是否使用*.${dnsTLSDomain}进行API申请通配符证书?[y/n]:" dnsAPIStatus
if [[ "${dnsAPIStatus}" != "y" ]]; then
exit 0
fi
fi
fi
}
@@ -1828,10 +1821,10 @@ acmeInstallSSL() {
if [[ "${dnsAPIType}" == "cloudflare" ]]; then
echoContent green " ---> DNS API 生成证书中"
sudo CF_Token="${cfAPIToken}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" --dns dns_cf -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
sudo CF_Token="${cfAPIToken}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_cf -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
elif [[ "${dnsAPIType}" == "aliyun" ]]; then
echoContent green " ---> DNS API 生成证书中"
sudo Ali_Key="${aliKey}" Ali_Secret="${aliSecret}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" --dns dns_ali -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
sudo Ali_Key="${aliKey}" Ali_Secret="${aliSecret}" "$HOME/.acme.sh/acme.sh" --issue -d "${dnsAPIDomain}" -d "${dnsTLSDomain}" --dns dns_ali -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
else
echoContent green " ---> 生成证书中"
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" ${sslIPv6} 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
@@ -3979,67 +3972,65 @@ singBoxMergeConfig() {
}
# 初始化Xray Trojan XTLS 配置文件
initXrayFrontingConfig() {
echoContent red " ---> Trojan暂不支持 xtls-rprx-vision"
exit 0
if [[ -z "${configPath}" ]]; then
echoContent red " ---> 未安装,请使用脚本安装"
menu
exit 0
fi
if [[ "${coreInstallType}" != "1" ]]; then
echoContent red " ---> 未安装可用类型"
fi
local xtlsType=
if echo ${currentInstallProtocolType} | grep -q trojan; then
xtlsType=VLESS
else
xtlsType=Trojan
fi
echoContent skyBlue "\n功能 1/${totalProgress} : 前置切换为${xtlsType}"
echoContent red "\n=============================================================="
echoContent yellow "# 注意事项\n"
echoContent yellow "会将前置替换为${xtlsType}"
echoContent yellow "如果前置是Trojan,查看账号时则会出现两个Trojan协议的节点,有一个不可用xtls"
echoContent yellow "再次执行可切换至上一次的前置\n"
echoContent yellow "1.切换至${xtlsType}"
echoContent red "=============================================================="
read -r -p "请选择:" selectType
if [[ "${selectType}" == "1" ]]; then
if [[ "${xtlsType}" == "Trojan" ]]; then
local VLESSConfig
VLESSConfig=$(cat ${configPath}${frontingType}.json)
VLESSConfig=${VLESSConfig//"id"/"password"}
VLESSConfig=${VLESSConfig//VLESSTCP/TrojanTCPXTLS}
VLESSConfig=${VLESSConfig//VLESS/Trojan}
VLESSConfig=${VLESSConfig//"vless"/"trojan"}
VLESSConfig=${VLESSConfig//"id"/"password"}
echo "${VLESSConfig}" | jq . >${configPath}02_trojan_TCP_inbounds.json
rm ${configPath}${frontingType}.json
elif [[ "${xtlsType}" == "VLESS" ]]; then
local VLESSConfig
VLESSConfig=$(cat ${configPath}02_trojan_TCP_inbounds.json)
VLESSConfig=${VLESSConfig//"password"/"id"}
VLESSConfig=${VLESSConfig//TrojanTCPXTLS/VLESSTCP}
VLESSConfig=${VLESSConfig//Trojan/VLESS}
VLESSConfig=${VLESSConfig//"trojan"/"vless"}
VLESSConfig=${VLESSConfig//"password"/"id"}
echo "${VLESSConfig}" | jq . >${configPath}02_VLESS_TCP_inbounds.json
rm ${configPath}02_trojan_TCP_inbounds.json
fi
reloadCore
fi
exit 0
}
#initXrayFrontingConfig() {
# echoContent red " ---> Trojan暂不支持 xtls-rprx-vision"
# if [[ -z "${configPath}" ]]; then
# echoContent red " ---> 未安装,请使用脚本安装"
# menu
# exit 0
# fi
# if [[ "${coreInstallType}" != "1" ]]; then
# echoContent red " ---> 未安装可用类型"
# fi
# local xtlsType=
# if echo ${currentInstallProtocolType} | grep -q trojan; then
# xtlsType=VLESS
# else
# xtlsType=Trojan
# fi
#
# echoContent skyBlue "\n功能 1/${totalProgress} : 前置切换为${xtlsType}"
# echoContent red "\n=============================================================="
# echoContent yellow "# 注意事项\n"
# echoContent yellow "会将前置替换为${xtlsType}"
# echoContent yellow "如果前置是Trojan,查看账号时则会出现两个Trojan协议的节点,有一个不可用xtls"
# echoContent yellow "再次执行可切换至上一次的前置\n"
#
# echoContent yellow "1.切换至${xtlsType}"
# echoContent red "=============================================================="
# read -r -p "请选择:" selectType
# if [[ "${selectType}" == "1" ]]; then
#
# if [[ "${xtlsType}" == "Trojan" ]]; then
#
# local VLESSConfig
# VLESSConfig=$(cat ${configPath}${frontingType}.json)
# VLESSConfig=${VLESSConfig//"id"/"password"}
# VLESSConfig=${VLESSConfig//VLESSTCP/TrojanTCPXTLS}
# VLESSConfig=${VLESSConfig//VLESS/Trojan}
# VLESSConfig=${VLESSConfig//"vless"/"trojan"}
# VLESSConfig=${VLESSConfig//"id"/"password"}
#
# echo "${VLESSConfig}" | jq . >${configPath}02_trojan_TCP_inbounds.json
# rm ${configPath}${frontingType}.json
# elif [[ "${xtlsType}" == "VLESS" ]]; then
#
# local VLESSConfig
# VLESSConfig=$(cat ${configPath}02_trojan_TCP_inbounds.json)
# VLESSConfig=${VLESSConfig//"password"/"id"}
# VLESSConfig=${VLESSConfig//TrojanTCPXTLS/VLESSTCP}
# VLESSConfig=${VLESSConfig//Trojan/VLESS}
# VLESSConfig=${VLESSConfig//"trojan"/"vless"}
# VLESSConfig=${VLESSConfig//"password"/"id"}
#
# echo "${VLESSConfig}" | jq . >${configPath}02_VLESS_TCP_inbounds.json
# rm ${configPath}02_trojan_TCP_inbounds.json
# fi
# reloadCore
# fi
#
# exit 0
#}
# 初始化sing-box端口
initSingBoxPort() {
@@ -4952,11 +4943,10 @@ EOF
rm /etc/v2ray-agent/sing-box/conf/config/11_VMess_HTTPUpgrade_inbounds.json >/dev/null 2>&1
fi
if [[ -z "$3" ]]; then
# removeSingBoxConfig wireguard_out_IPv4
# removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv4_route
removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound
removeSingBoxConfig wireguard_endpoints_IPv4_route
removeSingBoxConfig wireguard_endpoints_IPv6_route
removeSingBoxConfig wireguard_endpoints_IPv4
removeSingBoxConfig wireguard_endpoints_IPv6
removeSingBoxConfig IPv4_out
removeSingBoxConfig IPv6_out
@@ -5449,60 +5439,24 @@ showAccounts() {
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
done
fi
# VLESS XHTTP
if echo ${currentInstallProtocolType} | grep -q ",12,"; then
echoContent skyBlue "\n================================ VLESS XHTTP TLS [仅CDN推荐] ================================\n"
jq .inbounds[0].settings.clients//.inbounds[0].users ${configPath}12_VLESS_XHTTP_inbounds.json | jq -c '.[]' | while read -r user; do
local email=
email=$(echo "${user}" | jq -r .email//.name)
# local vlessXHTTPPort=${xrayVLESSRealityXHTTPort}
# if [[ "${coreInstallType}" == "2" ]]; then
# vlessXHTTPPort="${singBoxVLESSWSPort}"
# fi
echo
local path="${currentPath}xHTTP"
# if [[ ${coreInstallType} == "1" ]]; then
# path="/${currentPath}ws"
# elif [[ "${coreInstallType}" == "2" ]]; then
# path="${singBoxVLESSWSPath}"
# fi
local count=
while read -r line; do
echoContent skyBlue "\n ---> 账号:${email}${count}"
if [[ -n "${line}" ]]; then
defaultBase64Code vlessXHTTP "${xrayVLESSRealityXHTTPort}" "${email}${count}" "$(echo "${user}" | jq -r .id//.uuid)" "${line}" "${path}"
count=$((count + 1))
echo
fi
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
done
fi
# VLESS grpc
if echo ${currentInstallProtocolType} | grep -q ",5,"; then
echoContent skyBlue "\n=============================== VLESS gRPC TLS [仅CDN推荐] ===============================\n"
jq .inbounds[0].settings.clients ${configPath}06_VLESS_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
# trojan grpc
if echo ${currentInstallProtocolType} | grep -q ",2,"; then
echoContent skyBlue "\n================================ Trojan gRPC TLS [仅CDN推荐] ================================\n"
jq .inbounds[0].settings.clients ${configPath}04_trojan_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
local email=
email=$(echo "${user}" | jq -r .email)
local count=
while read -r line; do
echoContent skyBlue "\n ---> 账号:${email}${count}"
echo
if [[ -n "${line}" ]]; then
defaultBase64Code vlessgrpc "${currentDefaultPort}" "${email}${count}" "$(echo "${user}" | jq -r .id)" "${line}"
defaultBase64Code trojangrpc "${currentDefaultPort}" "${email}${count}" "$(echo "${user}" | jq -r .password)" "${line}"
count=$((count + 1))
fi
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
done
fi
# VMess WS
if echo ${currentInstallProtocolType} | grep -q ",3,"; then
echoContent skyBlue "\n================================ VMess WS TLS [仅CDN推荐] ================================\n"
@@ -5544,19 +5498,20 @@ showAccounts() {
defaultBase64Code trojan "${currentDefaultPort}${singBoxTrojanPort}" "${email}" "$(echo "${user}" | jq -r .password)"
done
fi
# VLESS grpc
if echo ${currentInstallProtocolType} | grep -q ",5,"; then
echoContent skyBlue "\n=============================== VLESS gRPC TLS [仅CDN推荐] ===============================\n"
jq .inbounds[0].settings.clients ${configPath}06_VLESS_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
# trojan grpc
if echo ${currentInstallProtocolType} | grep -q ",2,"; then
echoContent skyBlue "\n================================ Trojan gRPC TLS [仅CDN推荐] ================================\n"
jq .inbounds[0].settings.clients ${configPath}04_trojan_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
local email=
email=$(echo "${user}" | jq -r .email)
local count=
while read -r line; do
echoContent skyBlue "\n ---> 账号:${email}${count}"
echo
if [[ -n "${line}" ]]; then
defaultBase64Code trojangrpc "${currentDefaultPort}" "${email}${count}" "$(echo "${user}" | jq -r .password)" "${line}"
defaultBase64Code vlessgrpc "${currentDefaultPort}" "${email}${count}" "$(echo "${user}" | jq -r .id)" "${line}"
count=$((count + 1))
fi
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
@@ -5663,6 +5618,27 @@ showAccounts() {
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
done
fi
# VLESS XHTTP
if echo ${currentInstallProtocolType} | grep -q ",12,"; then
echoContent skyBlue "\n================================ VLESS XHTTP TLS [仅CDN推荐] ================================\n"
jq .inbounds[0].settings.clients//.inbounds[0].users ${configPath}12_VLESS_XHTTP_inbounds.json | jq -c '.[]' | while read -r user; do
local email=
email=$(echo "${user}" | jq -r .email//.name)
echo
local path="${currentPath}xHTTP"
local count=
while read -r line; do
echoContent skyBlue "\n ---> 账号:${email}${count}"
if [[ -n "${line}" ]]; then
defaultBase64Code vlessXHTTP "${xrayVLESSRealityXHTTPort}" "${email}${count}" "$(echo "${user}" | jq -r .id//.uuid)" "${line}" "${path}"
count=$((count + 1))
echo
fi
done < <(echo "${currentCDNAddress}" | tr ',' '\n')
done
fi
}
# 移除nginx302配置
removeNginx302() {
@@ -6632,13 +6608,11 @@ ipv6Routing() {
if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxConfig IPv4_out
# removeSingBoxConfig wireguard_out_IPv4
removeSingBoxConfig wireguard_out_IPv4_route
# removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound
removeSingBoxConfig wireguard_endpoints_IPv4_route
removeSingBoxConfig wireguard_endpoints_IPv6_route
removeSingBoxConfig wireguard_endpoints_IPv4
removeSingBoxConfig wireguard_endpoints_IPv6
removeSingBoxConfig socks5_inbound_route
@@ -7023,10 +6997,10 @@ showWireGuardDomain() {
# sing-box
if [[ -n "${singBoxConfigPath}" ]]; then
if [[ -f "${singBoxConfigPath}wireguard_out_${type}_route.json" ]]; then
if [[ -f "${singBoxConfigPath}wireguard_endpoints_${type}_route.json" ]]; then
echoContent yellow "sing-box"
jq -r -c '.route.rules[]' "${singBoxConfigPath}wireguard_out_${type}_route.json" | jq -r
elif [[ ! -f "${singBoxConfigPath}wireguard_out_${type}_route.json" && -f "${singBoxConfigPath}wireguard_out_${type}.json" ]]; then
jq -r -c '.route.rules[]' "${singBoxConfigPath}wireguard_endpoints_${type}_route.json" | jq -r
elif [[ ! -f "${singBoxConfigPath}wireguard_endpoints_${type}_route.json" && -f "${singBoxConfigPath}wireguard_endpoints_${type}.json" ]]; then
echoContent yellow "sing-box"
echoContent green " ---> 已设置warp ${type}全局分流"
else
@@ -7428,14 +7402,12 @@ setSocks5OutboundRoutingAll() {
if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxConfig IPv4_out
# removeSingBoxConfig wireguard_out_IPv4
removeSingBoxConfig wireguard_out_IPv4_route
removeSingBoxConfig IPv6_out
# removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound
removeSingBoxConfig wireguard_endpoints_IPv4_route
removeSingBoxConfig wireguard_endpoints_IPv6_route
removeSingBoxConfig wireguard_endpoints_IPv4
removeSingBoxConfig wireguard_endpoints_IPv6
removeSingBoxConfig socks5_outbound_route
removeSingBoxConfig 01_direct_outbound
@@ -9752,7 +9724,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者:mack-a"
echoContent green "当前版本:v3.4.8"
echoContent green "当前版本:v3.4.12"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c"
showInstallStatus
@@ -9799,9 +9771,9 @@ menu() {
2)
selectCoreInstall
;;
3)
initXrayFrontingConfig 1
;;
# 3)
# initXrayFrontingConfig 1
# ;;
4)
manageHysteria
;;