mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-23 16:38:34 +08:00
support fallback website
This commit is contained in:
56
startup.sh
56
startup.sh
@@ -1,58 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat << EOF > /etc/v2ray/config.json
|
||||
{
|
||||
"policy": {
|
||||
"levels": {
|
||||
"0": {
|
||||
"handshake": 5,
|
||||
"connIdle": 300,
|
||||
"uplinkOnly": 2,
|
||||
"downlinkOnly": 5,
|
||||
"statsUserUplink": false,
|
||||
"statsUserDownlink": false,
|
||||
"bufferSize": 10240
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"statsInboundUplink": false,
|
||||
"statsInboundDownlink": false,
|
||||
"statsOutboundUplink": false,
|
||||
"statsOutboundDownlink": false
|
||||
}
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"port": $PORT,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "$UUID",
|
||||
"level": 0
|
||||
}
|
||||
],
|
||||
"decryption": "none"
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "ws",
|
||||
"security": "none"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
envsubst < /root/config.json.tp > /root/config.json
|
||||
envsubst '\$PORT' < /root/nginx.template.conf > /root/nginx.conf
|
||||
|
||||
|
||||
# Run V2Ray
|
||||
if [[ $TUNNEL_TOKEN ]]; then
|
||||
echo 'has tunnel token, run cloudflared tunnel'
|
||||
/usr/bin/v2ray -config /etc/v2ray/config.json & /root/cloudflared tunnel --no-autoupdate run --token $TUNNEL_TOKEN
|
||||
wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /root/cloudflared
|
||||
chmod +x /root/cloudflared
|
||||
/usr/bin/v2ray -config /root/config.json & /root/cloudflared tunnel --no-autoupdate run --token $TUNNEL_TOKEN & nginx -c /root/nginx.conf -g 'daemon off;'
|
||||
else
|
||||
/usr/bin/v2ray -config /etc/v2ray/config.json
|
||||
/usr/bin/v2ray -config /root/config.json & nginx -c /root/nginx.conf -g 'daemon off;'
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user