feat(脚本): 兼容xtls、添加trojan-go ws
parent
05d7ed9146
commit
f77ce1ec45
54
install.sh
54
install.sh
|
@ -396,7 +396,7 @@ echoContent skyBlue "\n进度 1/1 : 更新证书"
|
||||||
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -d "/etc/v2ray-agent/tls" ]] && [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] && [[ -d "/root/.acme.sh" ]]
|
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -d "/etc/v2ray-agent/tls" ]] && [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] && [[ -d "/root/.acme.sh" ]]
|
||||||
then
|
then
|
||||||
tcp=\`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]\`
|
tcp=\`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]\`
|
||||||
host=\`echo \${tcp}|jq .streamSettings.tlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print \$2}'|awk -F '["]' '{print \$1}'|awk -F '[.][c][r][t]' '{print \$1}'\`
|
host=\`echo \${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print \$2}'|awk -F '["]' '{print \$1}'|awk -F '[.][c][r][t]' '{print \$1}'\`
|
||||||
if [[ -d "/root/.acme.sh/\${host}_ecc" ]] && [[ -f "/root/.acme.sh/\${host}_ecc/\${host}.key" ]] && [[ -f "/root/.acme.sh/\${host}_ecc/\${host}.cer" ]]
|
if [[ -d "/root/.acme.sh/\${host}_ecc" ]] && [[ -f "/root/.acme.sh/\${host}_ecc/\${host}.key" ]] && [[ -f "/root/.acme.sh/\${host}_ecc/\${host}.cer" ]]
|
||||||
then
|
then
|
||||||
modifyTime=\`stat /root/.acme.sh/\${host}_ecc/\${host}.key|sed -n '6,6p'|awk '{print \$2" "\$3" "\$4" "\$5}'\`
|
modifyTime=\`stat /root/.acme.sh/\${host}_ecc/\${host}.key|sed -n '6,6p'|awk '{print \$2" "\$3" "\$4" "\$5}'\`
|
||||||
|
@ -457,7 +457,7 @@ renewalTLS(){
|
||||||
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -d "/etc/v2ray-agent/tls" ]] && [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] && [[ -d "/root/.acme.sh" ]]
|
if [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -d "/etc/v2ray-agent/tls" ]] && [[ -d "/etc/v2ray-agent" ]] && [[ -d "/etc/v2ray-agent/v2ray" ]] && [[ -f "/etc/v2ray-agent/v2ray/config.json" ]] && [[ -d "/root/.acme.sh" ]]
|
||||||
then
|
then
|
||||||
tcp=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]`
|
tcp=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]`
|
||||||
host=`echo ${tcp}|jq .streamSettings.tlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
||||||
if [[ -d "/root/.acme.sh/${host}_ecc" ]] && [[ -f "/root/.acme.sh/${host}_ecc/${host}.key" ]] && [[ -f "/root/.acme.sh/${host}_ecc/${host}.cer" ]]
|
if [[ -d "/root/.acme.sh/${host}_ecc" ]] && [[ -f "/root/.acme.sh/${host}_ecc/${host}.key" ]] && [[ -f "/root/.acme.sh/${host}_ecc/${host}.cer" ]]
|
||||||
then
|
then
|
||||||
modifyTime=`stat /root/.acme.sh/${host}_ecc/${host}.key|sed -n '6,6p'|awk '{print $2" "$3" "$4" "$5}'`
|
modifyTime=`stat /root/.acme.sh/${host}_ecc/${host}.key|sed -n '6,6p'|awk '{print $2" "$3" "$4" "$5}'`
|
||||||
|
@ -912,7 +912,7 @@ handleTrojanGo(){
|
||||||
echoContent green " ---> Trojan-Go启动成功"
|
echoContent green " ---> Trojan-Go启动成功"
|
||||||
else
|
else
|
||||||
echoContent red "Trojan-Go启动失败"
|
echoContent red "Trojan-Go启动失败"
|
||||||
echoContent red "请手动执行【/usr/bin/trojan/trojan-go -config /etc/v2ray-agent/trojan/config.json】,查看错误日志"
|
echoContent red "请手动执行【/etc/v2ray-agent/trojan/trojan-go -config /etc/v2ray-agent/trojan/config.json】,查看错误日志"
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
elif [[ "$1" = "stop" ]]
|
elif [[ "$1" = "stop" ]]
|
||||||
|
@ -954,6 +954,7 @@ initV2RayConfig(){
|
||||||
{
|
{
|
||||||
"id": "${uuidtcp}",
|
"id": "${uuidtcp}",
|
||||||
"alterId": 0,
|
"alterId": 0,
|
||||||
|
"flow":"xtls-rprx-origin",
|
||||||
"email": "${domain}_VLESS_TCP"
|
"email": "${domain}_VLESS_TCP"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -982,8 +983,8 @@ initV2RayConfig(){
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
"network": "tcp",
|
"network": "tcp",
|
||||||
"security": "tls",
|
"security": "xtls",
|
||||||
"tlsSettings": {
|
"xtlsSettings": {
|
||||||
"alpn": [
|
"alpn": [
|
||||||
"http/1.1"
|
"http/1.1"
|
||||||
],
|
],
|
||||||
|
@ -1101,7 +1102,7 @@ initTrojanGoConfig(){
|
||||||
cat << EOF > /etc/v2ray-agent/trojan/config.json
|
cat << EOF > /etc/v2ray-agent/trojan/config.json
|
||||||
{
|
{
|
||||||
"run_type": "server",
|
"run_type": "server",
|
||||||
"local_addr": "0.0.0.0",
|
"local_addr": "127.0.0.1",
|
||||||
"local_port": 31296,
|
"local_port": 31296,
|
||||||
"remote_addr": "127.0.0.1",
|
"remote_addr": "127.0.0.1",
|
||||||
"remote_port": 80,
|
"remote_port": 80,
|
||||||
|
@ -1113,6 +1114,14 @@ initTrojanGoConfig(){
|
||||||
"transport_plugin":{
|
"transport_plugin":{
|
||||||
"enabled":true,
|
"enabled":true,
|
||||||
"type":"plaintext"
|
"type":"plaintext"
|
||||||
|
},
|
||||||
|
"websocket": {
|
||||||
|
"enabled": true,
|
||||||
|
"path": "/${customPath}tws",
|
||||||
|
"host": "${domain}"
|
||||||
|
},
|
||||||
|
"router": {
|
||||||
|
"enabled": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
@ -1206,12 +1215,21 @@ defaultBase64Code(){
|
||||||
echoContent green ' {"port":"443","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":"443","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'
|
||||||
elif [[ "${type}" = "trojan" ]]
|
elif [[ "${type}" = "trojan" ]]
|
||||||
then
|
then
|
||||||
qrCodeBase64Default=`echo -n ${id}@${host}:443?peer=${host}&sni=${host}|base64`
|
|
||||||
qrCodeBase64Default=`echo ${qrCodeBase64Default}|sed 's/ //g'`
|
|
||||||
echoContent yellow " ---> Trojan(TLS)"
|
echoContent yellow " ---> Trojan(TLS)"
|
||||||
echoContent green " trojan://${id}@${host}:443?peer=${host}&sni=${host}\n"
|
echoContent green " trojan://${id}@${host}:443?peer=${host}&sni=${host}\n"
|
||||||
echoContent yellow " ---> 二维码 vmess(VMess+TCP+TLS)"
|
echoContent yellow " ---> 二维码 Trojan(TLS)"
|
||||||
echoContent green "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan://${qrCodeBase64Default}\n"
|
echoContent green "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan://${id}@${host}:443?peer=${host}&sni=${host}\n"
|
||||||
|
|
||||||
|
elif [[ "${type}" = "trojangows" ]]
|
||||||
|
then
|
||||||
|
echoContent yellow " ---> Trojan-Go(WS+TLS)"
|
||||||
|
echoContent green " trojan://${id}@${host}:443?plugin=obfs-local&obfs=websocket&obfs-host=${host}&obfs-uri=${path}&peer=${host}&sni=${host}\n"
|
||||||
|
echoContent yellow " ---> 二维码 Trojan-Go(WS+TLS)"
|
||||||
|
echoContent green "https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan://${id}@${host}:443?allowInsecure=0&peer=${host}&plugin=obfs-local;obfs=websocket;obfs-host=${host};obfs-uri=${path}\n"
|
||||||
|
trojan://ae2729a3d-cfa8-f813-d558-0de1c7334b3@centos7.z0fk.xyz:443?allowInsecure=0&peer=centos7.z0fk.xyz&plugin=obfs-local;obfs=websocket;obfs-host=centos7.z0fk.xyz;obfs-uri=/faaqtws
|
||||||
|
trojan://e2729a3d-cfa8-f813-d558-0de1c7334b3@192.168.2.156:4433?allowInsecure=1&peer=v2ray.me&plugin=obfs-local;obfs=websocket;obfs-host=v2ray.me;obfs-uri=/ws
|
||||||
|
|
||||||
|
# trojan://e2729a3d-cfa8-f813-d558-0de1c7334b3a@centos7.z0fk.xyz:443?peer=centos7.z0fk.xyz&sni=centos7.z0fk.xyz&plugin=obfs-local&obfs=websocket&obfs-host=centos7.z0fk.xyz&obfs-uri="/faaqtws"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# quanMult base64Code
|
# quanMult base64Code
|
||||||
|
@ -1302,7 +1320,7 @@ showAccounts(){
|
||||||
local tcp=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]`
|
local tcp=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]`
|
||||||
local tcpID=`echo ${tcp}|jq .settings.clients[0].id`
|
local tcpID=`echo ${tcp}|jq .settings.clients[0].id`
|
||||||
local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
||||||
host=`echo ${tcp}|jq .streamSettings.tlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
||||||
|
|
||||||
# VLESS ws
|
# VLESS ws
|
||||||
local vlessWS=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[3]`
|
local vlessWS=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[3]`
|
||||||
|
@ -1326,24 +1344,28 @@ showAccounts(){
|
||||||
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
|
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
|
||||||
|
|
||||||
|
|
||||||
echoContent skyBlue "\n=============================== VLESS+TCP+TLS ==============================="
|
echoContent skyBlue "\n=============================== VLESS TCP TLS ==============================="
|
||||||
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}" ${add}
|
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}" ${add}
|
||||||
|
|
||||||
echoContent skyBlue "\n===============================VLESS+WS+TLS+CDN==============================="
|
echoContent skyBlue "\n===============================VLESS WS TLS CDN==============================="
|
||||||
defaultBase64Code vlessws ${vlessWSEmail} "${vlessWSID}" "${host}" "${vlessWSPath}" ${vlessWSAdd}
|
defaultBase64Code vlessws ${vlessWSEmail} "${vlessWSID}" "${host}" "${vlessWSPath}" ${vlessWSAdd}
|
||||||
|
|
||||||
echoContent skyBlue "\n===============================VMess+WS+TLS+CDN==============================="
|
echoContent skyBlue "\n===============================VMess WS TLS CDN==============================="
|
||||||
defaultBase64Code vmessws ${wsEmail} "${wsID}" "${host}" "${wsPath}" ${wsAdd}
|
defaultBase64Code vmessws ${wsEmail} "${wsID}" "${host}" "${wsPath}" ${wsAdd}
|
||||||
|
|
||||||
echoContent skyBlue "\n=============================== VMess+TCP+TLS ==============================="
|
echoContent skyBlue "\n=============================== VMess TCP TLS ==============================="
|
||||||
defaultBase64Code vmesstcp ${vmessTCPEmail} "${vmessTCPID}" "${host}" "${vmessTCPath}" "${host}"
|
defaultBase64Code vmesstcp ${vmessTCPEmail} "${vmessTCPID}" "${host}" "${vmessTCPath}" "${host}"
|
||||||
fi
|
fi
|
||||||
if [[ -d "/etc/v2ray-agent/" ]] && [[ -d "/etc/v2ray-agent/trojan/" ]] && [[ -f "/etc/v2ray-agent/trojan/config.json" ]]
|
if [[ -d "/etc/v2ray-agent/" ]] && [[ -d "/etc/v2ray-agent/trojan/" ]] && [[ -f "/etc/v2ray-agent/trojan/config.json" ]]
|
||||||
then
|
then
|
||||||
showStatus=true
|
showStatus=true
|
||||||
local trojanUUID=`cat /etc/v2ray-agent/trojan/config.json |jq .password[0]|awk -F '["]' '{print $2}'`
|
local trojanUUID=`cat /etc/v2ray-agent/trojan/config.json |jq .password[0]|awk -F '["]' '{print $2}'`
|
||||||
|
local trojanGoPath=`cat /etc/v2ray-agent/trojan/config.json|jq .websocket.path`
|
||||||
echoContent skyBlue "\n=============================== Trojan TLS ==============================="
|
echoContent skyBlue "\n=============================== Trojan TLS ==============================="
|
||||||
defaultBase64Code trojan trojan ${trojanUUID} ${host}
|
defaultBase64Code trojan trojan ${trojanUUID} ${host}
|
||||||
|
|
||||||
|
echoContent skyBlue "\n=============================== Trojan WS TLS ==============================="
|
||||||
|
defaultBase64Code trojangows trojan ${trojanUUID} ${host} ${trojanGoPath}
|
||||||
fi
|
fi
|
||||||
if [[ -z ${showStatus} ]]
|
if [[ -z ${showStatus} ]]
|
||||||
then
|
then
|
||||||
|
@ -1445,6 +1467,8 @@ menu(){
|
||||||
echoContent yellow "10.更新证书"
|
echoContent yellow "10.更新证书"
|
||||||
echoContent skyBlue "--------------------------------------------------------------"
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
echoContent yellow "11.卸载脚本"
|
echoContent yellow "11.卸载脚本"
|
||||||
|
echoContent yellow "12.重置uuid[todo]"
|
||||||
|
echoContent yellow "13.任意组合安装[todo]"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
automaticUpgrade
|
automaticUpgrade
|
||||||
read -p "请选择:" selectInstallType
|
read -p "请选择:" selectInstallType
|
||||||
|
|
Loading…
Reference in New Issue