-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·63 lines (57 loc) · 1.26 KB
/
Copy pathentrypoint.sh
File metadata and controls
executable file
·63 lines (57 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
set -e
# Read environment variables with fallback defaults
UUID="${UUID:-de04add9-5c68-8bab-950c-08cd5320df18}"
WSPATH="${WSPATH:-/vless-ws}"
PORT="${PORT:-10000}"
# Ensure WSPATH starts with a leading slash
if [[ "${WSPATH:0:1}" != "/" ]]; then
WSPATH="/${WSPATH}"
fi
echo "========================================="
echo " Starting VLESS WebSocket Proxy Server "
echo " Port: ${PORT}"
echo " WebSocket Path: ${WSPATH}"
echo " UUID: ${UUID}"
echo "========================================="
# Dynamically generate /app/config.json
cat <<EOF > /app/config.json
{
"log": {
"loglevel": "warning"
},
"inbounds": [
{
"port": ${PORT},
"listen": "0.0.0.0",
"protocol": "vless",
"settings": {
"clients": [
{
"id": "${UUID}",
"level": 0
}
],
"decryption": "none"
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "${WSPATH}"
}
}
}
],
"outbounds": [
{
"protocol": "freedom"
}
]
}
EOF
# Validate JSON syntax with jq
if command -v jq >/dev/null 2>&1; then
jq . /app/config.json >/dev/null
fi
# Execute Xray-core
exec /app/xray -config /app/config.json