mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 添加trojan gRPC
parent
5402d8dbde
commit
54c3f9592f
134
install.sh
134
install.sh
|
@ -224,7 +224,7 @@ readInstallProtocolType() {
|
|||
if echo ${row} | grep -q VLESS_WS_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'1'
|
||||
fi
|
||||
if echo ${row} | grep -q VMess_TCP_inbounds; then
|
||||
if echo ${row} | grep -q trojan_gRPC_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'2'
|
||||
fi
|
||||
if echo ${row} | grep -q VMess_WS_inbounds; then
|
||||
|
@ -675,7 +675,44 @@ server {
|
|||
return 403;
|
||||
}
|
||||
EOF
|
||||
if echo "${selectCustomInstallType}" |grep -q 5 || [[ -z "${selectCustomInstallType}" ]]; then
|
||||
if [[ -n $(echo "${selectCustomInstallType}" |grep 2) && -n $(echo "${selectCustomInstallType}" |grep 5) ]] || [[ -z "${selectCustomInstallType}" ]];then
|
||||
|
||||
cat <<EOF >>/etc/nginx/conf.d/alone.conf
|
||||
server {
|
||||
listen 127.0.0.1:31302 http2;
|
||||
server_name ${domain};
|
||||
root /usr/share/nginx/html;
|
||||
location /s/ {
|
||||
add_header Content-Type text/plain;
|
||||
alias /etc/v2ray-agent/subscribe/;
|
||||
}
|
||||
|
||||
location /${currentPath}grpc {
|
||||
client_max_body_size 0;
|
||||
# keepalive_time 1071906480m;
|
||||
keepalive_requests 4294967296;
|
||||
client_body_timeout 1071906480m;
|
||||
send_timeout 1071906480m;
|
||||
lingering_close always;
|
||||
grpc_read_timeout 1071906480m;
|
||||
grpc_send_timeout 1071906480m;
|
||||
grpc_pass grpc://127.0.0.1:31301;
|
||||
}
|
||||
|
||||
location /${currentPath}trojangrpc {
|
||||
client_max_body_size 0;
|
||||
# keepalive_time 1071906480m;
|
||||
keepalive_requests 4294967296;
|
||||
client_body_timeout 1071906480m;
|
||||
send_timeout 1071906480m;
|
||||
lingering_close always;
|
||||
grpc_read_timeout 1071906480m;
|
||||
grpc_send_timeout 1071906480m;
|
||||
grpc_pass grpc://127.0.0.1:31304;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
elif echo "${selectCustomInstallType}" |grep -q 5 || [[ -z "${selectCustomInstallType}" ]]; then
|
||||
cat <<EOF >>/etc/nginx/conf.d/alone.conf
|
||||
server {
|
||||
listen 127.0.0.1:31302 http2;
|
||||
|
@ -694,12 +731,37 @@ server {
|
|||
lingering_close always;
|
||||
grpc_read_timeout 1071906480m;
|
||||
grpc_send_timeout 1071906480m;
|
||||
grpc_pass grpc://127.0.0.1:31301;
|
||||
grpc_pass grpc://127.0.0.1:31304;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
elif echo "${selectCustomInstallType}" |grep -q 2 || [[ -z "${selectCustomInstallType}" ]];then
|
||||
|
||||
cat <<EOF >>/etc/nginx/conf.d/alone.conf
|
||||
server {
|
||||
listen 127.0.0.1:31302 http2;
|
||||
server_name ${domain};
|
||||
root /usr/share/nginx/html;
|
||||
location /s/ {
|
||||
add_header Content-Type text/plain;
|
||||
alias /etc/v2ray-agent/subscribe/;
|
||||
}
|
||||
location /${currentPath}trojangrpc {
|
||||
client_max_body_size 0;
|
||||
# keepalive_time 1071906480m;
|
||||
keepalive_requests 4294967296;
|
||||
client_body_timeout 1071906480m;
|
||||
send_timeout 1071906480m;
|
||||
lingering_close always;
|
||||
grpc_read_timeout 1071906480m;
|
||||
grpc_send_timeout 1071906480m;
|
||||
grpc_pass grpc://127.0.0.1:31301;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
else
|
||||
|
||||
cat <<EOF >>/etc/nginx/conf.d/alone.conf
|
||||
server {
|
||||
listen 127.0.0.1:31302 http2;
|
||||
|
@ -2144,6 +2206,44 @@ EOF
|
|||
# fi
|
||||
|
||||
|
||||
# # trojan_gRPC
|
||||
|
||||
# trojan_grpc
|
||||
if echo ${selectCustomInstallType} | grep -q 2 || [[ "$1" == "all" ]]; then
|
||||
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_gRPC_inbounds.json
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 31304,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "trojan",
|
||||
"tag": "trojangRPCTCP",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "${uuid}",
|
||||
"email": "${domain}_trojan_gRPC"
|
||||
}
|
||||
],
|
||||
"fallbacks": [
|
||||
{
|
||||
"dest": "31300"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "grpc",
|
||||
"grpcSettings": {
|
||||
"serviceName": "${customPath}trojangrpc"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# VMess_WS
|
||||
if echo "${selectCustomInstallType}" | grep -q 3 || [[ "$1" == "all" ]]; then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
|
||||
|
@ -2454,7 +2554,7 @@ EOF
|
|||
VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}')
|
||||
|
||||
echoContent yellow " ---> 通用格式(VLESS+gRPC+TLS)"
|
||||
echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&serviceName=${path}&alpn=h2&sni=${host}#${VLESSEmail}\n"
|
||||
echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&path=${path}&serviceName=${path}&alpn=h2&sni=${host}#${VLESSEmail}\n"
|
||||
|
||||
echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)"
|
||||
echoContent green " 协议类型:VLESS,地址:${add},伪装域名/SNI:${host},端口:${port},用户ID:${VLESSID},安全:tls,传输方式:gRPC,alpn:h2,serviceName:${path},账户名:${VLESSEmail}\n"
|
||||
|
@ -2476,6 +2576,18 @@ EOF
|
|||
echoContent yellow " ---> 二维码 Trojan(TLS)"
|
||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${host}%3a${port}%3fpeer%3d${host}%26sni%3d${host}%26alpn%3Dhttp1.1%23${host}_trojan\n"
|
||||
|
||||
elif [[ "${type}" == "trojangrpc" ]]; then
|
||||
# URLEncode
|
||||
|
||||
echoContent yellow " ---> Trojan gRPC(TLS)"
|
||||
echoContent green " trojan://${id}@${host}:${port}?encryption=none&peer=${host}&security=tls&type=grpc&sni=${host}&alpn=h2&path=${path}&serviceName=${path}#${host}_trojan_gRPC\n"
|
||||
|
||||
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
|
||||
trojan://${id}@${host}:${port}?encryption=none&peer=${host}&security=tls&type=grpc&sni=${host}&alpn=h2&path=${path}&serviceName=${path}#${host}_trojan_gRPC
|
||||
EOF
|
||||
echoContent yellow " ---> 二维码 Trojan gRPC(TLS)"
|
||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${host}%3a${port}%3Fencryption%3Dnone%26security%3Dtls%26peer%3d${host}%26type%3Dgrpc%26sni%3d${host}%26path%3D${path}%26alpn%3D=h2%26serviceName%3D${path}%23${host}_trojan_gRPC\n"
|
||||
|
||||
elif [[ "${type}" == "trojangows" ]]; then
|
||||
# URLEncode
|
||||
echoContent yellow " ---> Trojan-Go(WS+TLS) Shadowrocket"
|
||||
|
@ -2583,6 +2695,16 @@ showAccounts() {
|
|||
done
|
||||
fi
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q 2 || [[ -z "${currentInstallProtocolType}" ]]; then
|
||||
echoContent skyBlue "\n================================ Trojan gRPC TLS ================================\n"
|
||||
local serviceName=$(jq -r .inbounds[0].streamSettings.grpcSettings.serviceName ${configPath}04_trojan_gRPC_inbounds.json)
|
||||
jq .inbounds[0].settings.clients ${configPath}04_trojan_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email )_$(echo "${user}" | jq -r .password)"
|
||||
echo
|
||||
defaultBase64Code trojangrpc $(echo "${user}" | jq .email) $(echo "${user}" | jq -r .password) "${currentHost}:${currentPort}" ${serviceName} ${currentAdd}
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# # trojan-go
|
||||
# if [[ -d "/etc/v2ray-agent/" ]] && [[ -d "/etc/v2ray-agent/trojan/" ]] && [[ -f "/etc/v2ray-agent/trojan/config_full.json" ]]; then
|
||||
|
@ -3817,7 +3939,7 @@ customXrayInstall() {
|
|||
echoContent yellow "VLESS前置,默认安装0,如果只需要安装0,则只选择0即可"
|
||||
echoContent yellow "0.VLESS+TLS/XTLS+TCP"
|
||||
echoContent yellow "1.VLESS+TLS+WS[CDN]"
|
||||
# echoContent yellow "2.VMess+TLS+TCP"
|
||||
echoContent yellow "2.Trojan+TLS+gRPC[CDN]"
|
||||
echoContent yellow "3.VMess+TLS+WS[CDN]"
|
||||
# echoContent yellow "4.Trojan、Trojan+WS[CDN]"
|
||||
echoContent yellow "4.Trojan"
|
||||
|
@ -4074,7 +4196,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.5.13"
|
||||
echoContent green "当前版本:v2.5.14_dev_trojan"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
|
Loading…
Reference in New Issue