mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 添加websocket early data、gRPC
parent
1a8feb05eb
commit
de6c34c665
116
install.sh
116
install.sh
|
@ -162,6 +162,10 @@ readInstallProtocolType() {
|
||||||
if echo ${row} | grep -q VMess_WS_inbounds; then
|
if echo ${row} | grep -q VMess_WS_inbounds; then
|
||||||
currentInstallProtocolType=${currentInstallProtocolType}'3'
|
currentInstallProtocolType=${currentInstallProtocolType}'3'
|
||||||
fi
|
fi
|
||||||
|
if echo ${row} | grep -q VLESS_gRPC_inbounds; then
|
||||||
|
currentInstallProtocolType=${currentInstallProtocolType}'5'
|
||||||
|
fi
|
||||||
|
|
||||||
done < <(ls ${configPath} | grep inbounds.json | awk -F "[.]" '{print $1}')
|
done < <(ls ${configPath} | grep inbounds.json | awk -F "[.]" '{print $1}')
|
||||||
|
|
||||||
if [[ -f "/etc/v2ray-agent/trojan/trojan-go" ]] && [[ -f "/etc/v2ray-agent/trojan/config_full.json" ]]; then
|
if [[ -f "/etc/v2ray-agent/trojan/trojan-go" ]] && [[ -f "/etc/v2ray-agent/trojan/config_full.json" ]]; then
|
||||||
|
@ -257,6 +261,10 @@ showInstallStatus() {
|
||||||
if echo ${currentInstallProtocolType} | grep -q 4; then
|
if echo ${currentInstallProtocolType} | grep -q 4; then
|
||||||
echoContent yellow "Trojan+TCP/WS[TLS]\c"
|
echoContent yellow "Trojan+TCP/WS[TLS]\c"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if echo ${currentInstallProtocolType} | grep -q 5; then
|
||||||
|
echoContent yellow "VLESS+gRPC[TLS] \c"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1620,6 +1628,38 @@ EOF
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
# VLESS gRPC
|
||||||
|
if echo "${selectCustomInstallType}" | grep -q 5 || [[ "$1" == "all" ]]; then
|
||||||
|
fallbacksList=${fallbacksList}',{"alpn":"h2","dest":31301,"xver":0}'
|
||||||
|
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
||||||
|
{
|
||||||
|
"inbounds":[
|
||||||
|
{
|
||||||
|
"port": 31301,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vless",
|
||||||
|
"tag":"VLESSGRPC",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"add": "${add}",
|
||||||
|
"email": "${domain}_vless_grpc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "grpc",
|
||||||
|
"grpcSettings": {
|
||||||
|
"serviceName": "${customPath}grpc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1650,7 +1690,8 @@ EOF
|
||||||
"security": "tls",
|
"security": "tls",
|
||||||
"tlsSettings": {
|
"tlsSettings": {
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"http/1.1"
|
"http/1.1",
|
||||||
|
"h2"
|
||||||
],
|
],
|
||||||
"certificates": [
|
"certificates": [
|
||||||
{
|
{
|
||||||
|
@ -1924,6 +1965,38 @@ EOF
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if echo "${selectCustomInstallType}" | grep -q 5 || [[ "$1" == "all" ]]; then
|
||||||
|
fallbacksList=${fallbacksList}',{"alpn":"h2","dest":31301,"xver":0}'
|
||||||
|
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
||||||
|
{
|
||||||
|
"inbounds":[
|
||||||
|
{
|
||||||
|
"port": 31301,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vless",
|
||||||
|
"tag":"VLESSGRPC",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"add": "${add}",
|
||||||
|
"email": "${domain}_vless_grpc"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "grpc",
|
||||||
|
"grpcSettings": {
|
||||||
|
"serviceName": "${customPath}grpc"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
# VLESS_TCP
|
# VLESS_TCP
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
||||||
{
|
{
|
||||||
|
@ -1952,7 +2025,8 @@ EOF
|
||||||
"xtlsSettings": {
|
"xtlsSettings": {
|
||||||
"minVersion": "1.2",
|
"minVersion": "1.2",
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"http/1.1"
|
"http/1.1",
|
||||||
|
"h2"
|
||||||
],
|
],
|
||||||
"certificates": [
|
"certificates": [
|
||||||
{
|
{
|
||||||
|
@ -2139,6 +2213,15 @@ EOF
|
||||||
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/XTLS)"
|
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/XTLS)"
|
||||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${add}%3A${port}%3Fencryption%3Dnone%26security%3Dtls%26type%3Dws%26host%3D${host}%26path%3D%252f${path}%23${VLESSEmail}"
|
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${add}%3A${port}%3Fencryption%3Dnone%26security%3Dtls%26type%3Dws%26host%3D${host}%26path%3D%252f${path}%23${VLESSEmail}"
|
||||||
|
|
||||||
|
elif [[ "${type}" == "vlessgrpc" ]]; then
|
||||||
|
local VLESSID
|
||||||
|
VLESSID=$(echo "${id}" | awk -F "[\"]" '{print $2}')
|
||||||
|
local VLESSEmail
|
||||||
|
VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}')
|
||||||
|
|
||||||
|
echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)"
|
||||||
|
echoContent green " 协议类型:VLESS,地址:${add},伪装域名/SNI:${host},端口:${port},用户ID:${VLESSID},安全:tls,传输方式:gRPC,serviceName:${path},账户名:${VLESSEmail}\n"
|
||||||
|
|
||||||
elif [[ "${type}" == "trojan" ]]; then
|
elif [[ "${type}" == "trojan" ]]; then
|
||||||
# URLEncode
|
# URLEncode
|
||||||
echoContent yellow " ---> Trojan(TLS)"
|
echoContent yellow " ---> Trojan(TLS)"
|
||||||
|
@ -2169,6 +2252,7 @@ trojan-go://${id}@${add}:${port}?sni=${host}&type=ws&host=${host}&path=%2F${path
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echoContent green " trojan-go://${id}@${add}:${port}?sni=${host}&type=ws&host=${host}&path=%2F${path}#${host}_trojan_ws\n"
|
echoContent green " trojan-go://${id}@${add}:${port}?sni=${host}&type=ws&host=${host}&path=%2F${path}#${host}_trojan_ws\n"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 账号
|
# 账号
|
||||||
|
@ -2195,7 +2279,11 @@ showAccounts() {
|
||||||
|
|
||||||
# cat ${configPath}03_VLESS_WS_inbounds.json | jq .inbounds[0].settings.clients | jq -c '.[]'
|
# cat ${configPath}03_VLESS_WS_inbounds.json | jq .inbounds[0].settings.clients | jq -c '.[]'
|
||||||
jq .inbounds[0].settings.clients ${configPath}03_VLESS_WS_inbounds.json | jq -c '.[]' | while read -r user; do
|
jq .inbounds[0].settings.clients ${configPath}03_VLESS_WS_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||||
defaultBase64Code vlessws $(echo "${user}" | jq .email) $(echo "${user}" | jq .id) "${currentHost}:${currentPort}" "${currentPath}ws" ${currentAdd}
|
local path="${currentPath}ws"
|
||||||
|
if [[ ${coreInstallType} == "1" ]]; then
|
||||||
|
path="${currentPath}ws?ed=2048"
|
||||||
|
fi
|
||||||
|
defaultBase64Code vlessws $(echo "${user}" | jq .email) $(echo "${user}" | jq .id) "${currentHost}:${currentPort}" ${path} ${currentAdd}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2212,9 +2300,20 @@ showAccounts() {
|
||||||
# VMess WS
|
# VMess WS
|
||||||
if echo ${currentInstallProtocolType} | grep -q 3 || [[ -z "${currentInstallProtocolType}" ]]; then
|
if echo ${currentInstallProtocolType} | grep -q 3 || [[ -z "${currentInstallProtocolType}" ]]; then
|
||||||
echoContent skyBlue "\n================================ VMess WS TLS CDN ================================\n"
|
echoContent skyBlue "\n================================ VMess WS TLS CDN ================================\n"
|
||||||
# cat ${configPath}05_VMess_WS_inbounds.json | jq .inbounds[0].settings.clients | jq -c '.[]'
|
local path="${currentPath}vws"
|
||||||
|
if [[ ${coreInstallType} == "1" ]]; then
|
||||||
|
path="${currentPath}vws?ed=2048"
|
||||||
|
fi
|
||||||
jq .inbounds[0].settings.clients ${configPath}05_VMess_WS_inbounds.json | jq -c '.[]' | while read -r user; do
|
jq .inbounds[0].settings.clients ${configPath}05_VMess_WS_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||||
defaultBase64Code vmessws $(echo "${user}" | jq .email) $(echo "${user}" | jq .id) "${currentHost}:${currentPort}" "${currentPath}vws" ${currentAdd}
|
defaultBase64Code vmessws $(echo "${user}" | jq .email) $(echo "${user}" | jq .id) "${currentHost}:${currentPort}" ${path} ${currentAdd}
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# VLESS grpc
|
||||||
|
if echo ${currentInstallProtocolType} | grep -q 5 || [[ -z "${currentInstallProtocolType}" ]]; then
|
||||||
|
echoContent skyBlue "\n================================ VLESS gRPC TLS CDN ================================\n"
|
||||||
|
local serviceName=$(jq -r .inbounds[0].streamSettings.grpcSettings.serviceName ${configPath}06_VLESS_gRPC_inbounds.json)
|
||||||
|
jq .inbounds[0].settings.clients ${configPath}06_VLESS_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||||
|
defaultBase64Code vlessgrpc $(echo "${user}" | jq .email) $(echo "${user}" | jq .id) "${currentHost}:${currentPort}" ${serviceName} ${currentAdd}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -3292,12 +3391,13 @@ customXrayInstall() {
|
||||||
echoContent yellow "2.VMess+TLS+TCP"
|
echoContent yellow "2.VMess+TLS+TCP"
|
||||||
echoContent yellow "3.VMess+TLS+WS[CDN]"
|
echoContent yellow "3.VMess+TLS+WS[CDN]"
|
||||||
echoContent yellow "4.Trojan、Trojan+WS[CDN]"
|
echoContent yellow "4.Trojan、Trojan+WS[CDN]"
|
||||||
|
echoContent yellow "5.VLESS+TLS+gRPC[CDN]"
|
||||||
read -r -p "请选择[多选],[例如:123]:" selectCustomInstallType
|
read -r -p "请选择[多选],[例如:123]:" selectCustomInstallType
|
||||||
echoContent skyBlue "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
if [[ -z ${selectCustomInstallType} ]]; then
|
if [[ -z ${selectCustomInstallType} ]]; then
|
||||||
echoContent red " ---> 不可为空"
|
echoContent red " ---> 不可为空"
|
||||||
customXrayInstall
|
customXrayInstall
|
||||||
elif [[ "${selectCustomInstallType}" =~ ^[0-4]+$ ]]; then
|
elif [[ "${selectCustomInstallType}" =~ ^[0-5]+$ ]]; then
|
||||||
cleanUp v2rayClean
|
cleanUp v2rayClean
|
||||||
totalProgress=17
|
totalProgress=17
|
||||||
installTools 1
|
installTools 1
|
||||||
|
@ -3307,7 +3407,7 @@ customXrayInstall() {
|
||||||
handleNginx stop
|
handleNginx stop
|
||||||
initNginxConfig 4
|
initNginxConfig 4
|
||||||
# 随机path
|
# 随机path
|
||||||
if echo "${selectCustomInstallType}" | grep -q 1 || echo "${selectCustomInstallType}" | grep -q 3 || echo "${selectCustomInstallType}" | grep -q 4; then
|
if echo "${selectCustomInstallType}" | grep -q 1 || echo "${selectCustomInstallType}" | grep -q 3 || echo "${selectCustomInstallType}" | grep -q 4 || echo "${selectCustomInstallType}" | grep -q 5; then
|
||||||
randomPathFunction 5
|
randomPathFunction 5
|
||||||
customCDNIP 6
|
customCDNIP 6
|
||||||
fi
|
fi
|
||||||
|
@ -3636,7 +3736,7 @@ menu() {
|
||||||
cd "$HOME" || exit
|
cd "$HOME" || exit
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent green "作者:mack-a"
|
echoContent green "作者:mack-a"
|
||||||
echoContent green "当前版本:v2.4.16"
|
echoContent green "当前版本:v2.4.17"
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echoContent green "描述:七合一共存脚本\c"
|
echoContent green "描述:七合一共存脚本\c"
|
||||||
showInstallStatus
|
showInstallStatus
|
||||||
|
|
Loading…
Reference in New Issue