feat(脚本): 添加warp开机自启动任务、可能修复gRPC断流问题、添加SNI

pull/534/merge
mack-a 2021-06-29 09:59:01 +08:00
parent 7c0ba03576
commit 63166b1dfe
1 changed files with 24 additions and 15 deletions

View File

@ -600,6 +600,7 @@ installWarp(){
echoContent red " ---> 安装WARP失败" echoContent red " ---> 安装WARP失败"
exit 0; exit 0;
fi fi
systemctl enable warp-svc
warp-cli --accept-tos register warp-cli --accept-tos register
warp-cli --accept-tos set-mode proxy warp-cli --accept-tos set-mode proxy
warp-cli --accept-tos set-proxy-port 31303 warp-cli --accept-tos set-proxy-port 31303
@ -685,6 +686,14 @@ server {
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
location /${currentPath}grpc { 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; grpc_pass grpc://127.0.0.1:31301;
} }
} }
@ -2336,28 +2345,28 @@ defaultBase64Code() {
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-direct)"
echoContent green " vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&flow=xtls-rprx-direct#${VLESSEmail}\n" echoContent green " vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&sni=${host}&flow=xtls-rprx-direct#${VLESSEmail}\n"
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-direct)"
echoContent green "协议类型VLESS地址${host},端口:${port}用户ID${VLESSID}安全xtls传输方式tcpflowxtls-rprx-direct账户名:${VLESSEmail}\n" echoContent green "协议类型VLESS地址${host},端口:${port}用户ID${VLESSID}安全xtls传输方式tcpflowxtls-rprx-direct账户名:${VLESSEmail}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&flow=xtls-rprx-direct#${VLESSEmail} vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&sni=${host}&flow=xtls-rprx-direct#${VLESSEmail}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-direct)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${host}%3A${port}%3F${encryption}%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26flow%3Dxtls-rprx-direct%23${VLESSEmail}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${host}%3A${port}%3F${encryption}%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26sni%3D${host}%26flow%3Dxtls-rprx-direct%23${VLESSEmail}\n"
echoContent skyBlue "----------------------------------------------------------------------------------" echoContent skyBlue "----------------------------------------------------------------------------------"
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-splice)" echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-splice)"
echoContent green " vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&flow=xtls-rprx-splice#${VLESSEmail}\n" echoContent green " vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&sni=${host}&flow=xtls-rprx-splice#${VLESSEmail}\n"
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-splice)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-splice)"
echoContent green " 协议类型VLESS地址${host},端口:${port}用户ID${VLESSID}安全xtls传输方式tcpflowxtls-rprx-splice账户名:${VLESSEmail}\n" echoContent green " 协议类型VLESS地址${host},端口:${port}用户ID${VLESSID}安全xtls传输方式tcpflowxtls-rprx-splice账户名:${VLESSEmail}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&flow=xtls-rprx-splice#${VLESSEmail} vless://${VLESSID}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&sni=${host}&flow=xtls-rprx-splice#${VLESSEmail}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)" echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${host}%3A${port}%3F${encryption}%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26flow%3Dxtls-rprx-splice%23${VLESSEmail}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${VLESSID}%40${host}%3A${port}%3F${encryption}%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26sni%3D${host}%26flow%3Dxtls-rprx-splice%23${VLESSEmail}\n"
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)" echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)"
@ -2375,11 +2384,11 @@ EOF
elif [[ "${type}" == "vmessws" ]]; then elif [[ "${type}" == "vmessws" ]]; then
qrCodeBase64Default=$(echo -n '{"port":"'${port}'","ps":'${ps}',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":"/'${path}'","net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}' | sed 's#/#\\\/#g' | base64) qrCodeBase64Default=$(echo -n '{"port":"'${port}'","ps":'${ps}',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":"/'${path}'","net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'","sni":"'${host}'"}' | sed 's#/#\\\/#g' | base64)
qrCodeBase64Default=$(echo ${qrCodeBase64Default} | sed 's/ //g') qrCodeBase64Default=$(echo ${qrCodeBase64Default} | sed 's/ //g')
echoContent yellow " ---> 通用json(VMess+WS+TLS)" echoContent yellow " ---> 通用json(VMess+WS+TLS)"
echoContent green ' {"port":"'${port}'","ps":'${ps}',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":"/'${path}'","net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}\n' echoContent green ' {"port":"'${port}'","ps":'${ps}',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":"/'${path}'","net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'","sni":"'${host}'"}\n'
echoContent yellow " ---> 通用vmess(VMess+WS+TLS)链接" echoContent yellow " ---> 通用vmess(VMess+WS+TLS)链接"
echoContent green " vmess://${qrCodeBase64Default}\n" echoContent green " vmess://${qrCodeBase64Default}\n"
echoContent yellow " ---> 二维码 vmess(VMess+WS+TLS)" echoContent yellow " ---> 二维码 vmess(VMess+WS+TLS)"
@ -2426,17 +2435,17 @@ EOF
VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}') VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}')
echoContent yellow " ---> 通用格式(VLESS+WS+TLS)" echoContent yellow " ---> 通用格式(VLESS+WS+TLS)"
echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=ws&host=${host}&path=%2f${path}#${VLESSEmail}\n" echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=ws&host=${host}&sni=${host}&path=%2f${path}#${VLESSEmail}\n"
echoContent yellow " ---> 格式化明文(VLESS+WS+TLS)" echoContent yellow " ---> 格式化明文(VLESS+WS+TLS)"
echoContent green " 协议类型VLESS地址${add},伪装域名/SNI${host},端口:${port}用户ID${VLESSID}安全tls传输方式ws路径:/${path},账户名:${VLESSEmail}\n" echoContent green " 协议类型VLESS地址${add},伪装域名/SNI${host},端口:${port}用户ID${VLESSID}安全tls传输方式ws路径:/${path},账户名:${VLESSEmail}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=ws&host=${host}&path=%2f${path}#${VLESSEmail} vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=ws&host=${host}&sni=${host}&path=%2f${path}#${VLESSEmail}
EOF 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}%26sni%3D${host}%26path%3D%252f${path}%23${VLESSEmail}"
elif [[ "${type}" == "vlessgrpc" ]]; then elif [[ "${type}" == "vlessgrpc" ]]; then
local VLESSID local VLESSID
@ -2445,16 +2454,16 @@ EOF
VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}') VLESSEmail=$(echo "${ps}" | awk -F "[\"]" '{print $2}')
echoContent yellow " ---> 通用格式(VLESS+gRPC+TLS)" echoContent yellow " ---> 通用格式(VLESS+gRPC+TLS)"
echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&serviceName=${path}&alpn=h2#${VLESSEmail}\n" echoContent green " vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&serviceName=${path}&alpn=h2&sni=${host}#${VLESSEmail}\n"
echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)" echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)"
echoContent green " 协议类型VLESS地址${add},伪装域名/SNI${host},端口:${port}用户ID${VLESSID}安全tls传输方式gRPCalpnh2serviceName:${path},账户名:${VLESSEmail}\n" echoContent green " 协议类型VLESS地址${add},伪装域名/SNI${host},端口:${port}用户ID${VLESSID}安全tls传输方式gRPCalpnh2serviceName:${path},账户名:${VLESSEmail}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&path=${path}&serviceName=${path}&alpn=h2#${VLESSEmail} vless://${VLESSID}@${add}:${port}?encryption=none&security=tls&type=grpc&host=${host}&path=${path}&serviceName=${path}&alpn=h2&sni=${host}#${VLESSEmail}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+gRPC+TLS)" echoContent yellow " ---> 二维码 VLESS(VLESS+gRPC+TLS)"
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%3Dgrpc%26host%3D${host}%26serviceName%3D${path}%26path%3D${path}%26alpn%3Dh2%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%3Dgrpc%26host%3D${host}%26serviceName%3D${path}%26path%3D${path}%26sni%3D${host}%26alpn%3Dh2%23${VLESSEmail}"
elif [[ "${type}" == "trojan" ]]; then elif [[ "${type}" == "trojan" ]]; then
# URLEncode # URLEncode
@ -4065,7 +4074,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.5.10" echoContent green "当前版本v2.5.11"
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