forked from pengchujin/v2rayDocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
caddy.sh
executable file
·82 lines (76 loc) · 1.4 KB
/
caddy.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# FILE="/etc/Caddy"
domain="$1"
psname="$2"
#uuid=$(uuidgen)
cat > /etc/Caddyfile <<'EOF'
domain
{
log ./caddy.log
proxy /a98aa :61234 {
websocket
header_upstream -Origin
}
}
EOF
sed -i "s/domain/${domain}/" /etc/Caddyfile
# v2ray
cat > /etc/v2ray/config.json <<'EOF'
{
"inbounds": [
{
"port": 61234,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "6f0a2e13-2d0d-4382-8618-a98aaa06290e",
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws",
"wsSettings": {
"path": "/a98aa"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
EOF
#sed -i "s/uuid/${uuid}/" /etc/v2ray/config.json
cat > /srv/sebs.js <<'EOF'
{
"add":"domain",
"aid":"0",
"host":"",
"id":"6f0a2e13-2d0d-4382-8618-a98aaa06290e",
"net":"ws",
"path":"/a98aa",
"port":"443",
"ps":"sebsclub",
"tls":"tls",
"type":"none",
"v":"2"
}
EOF
if [ "$psname" != "" ] && [ "$psname" != "-c" ]; then
sed -i "s/sebsclub/${psname}/" /srv/sebs.js
sed -i "s/domain/${domain}/" /srv/sebs.js
sed -i "s/uuid/${uuid}/" /srv/sebs.js
else
$*
fi
pwd
cp /etc/Caddyfile .
nohup /bin/parent caddy --log stdout --agree=false &
cat /etc/v2ray/config.json
node v2ray.js
/usr/bin/v2ray -config /etc/v2ray/config.json