-
Notifications
You must be signed in to change notification settings - Fork 2
/
entrypoint.sh
executable file
·53 lines (47 loc) · 1.1 KB
/
entrypoint.sh
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
#!/bin/sh
DOMAIN="${DOMAIN:-example.com}"
UUID="${UUID:-$(cat /proc/sys/kernel/random/uuid)}"
ALTER_ID="${ALTER_ID:-64}"
PROXY_PATH="${PROXY_PATH:-/}"
PROXY_PORT="${PROXY_PORT:-80}"
export V2RAY_VMESS_AEAD_FORCED=${V2RAY_VMESS_AEAD_FORCED:-false}
echo "生成v2ray配置..."
cat > /etc/v2ray.json <<-EOF
{
"log": {
"loglevel": "${LOG_LEVEL:-error}"
},
"inbounds": [
{
"port": ${PROXY_PORT},
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "${UUID}",
"alterId": ${ALTER_ID}
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "${PROXY_PATH}"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
EOF
v2ray_url="vmess://$(echo auto:${UUID}@${DOMAIN}:${PROXY_PORT} | base64)?remarks=${DOMAIN}&obfsParam=www.microsoft.com&path=/&obfs=websocket&tfo=1&alterId=${ALTER_ID}"
echo "v2ray url: ${v2ray_url}"
echo "v2ray qrcode:"
qrterminal ${v2ray_url}
echo "启动v2ray..."
/usr/bin/v2ray run -config /etc/v2ray.json