forked from PaTTeeL/Docker-KintoHub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
62 lines (57 loc) · 1.19 KB
/
run.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
#!/bin/sh
UUID="c95ef1d4-f3ac-4586-96e9-234a37dda068"
PROTOCOL="vmess"
WS_PATH="/"
encode() {
arg1=$1
base64 $arg1
}
cat > config.json << EOF
{
"log": {
"loglevel": "none"
},
"inbounds": [
{
"port": 3000,
"protocol": "${PROTOCOL}",
"settings": {
"decryption": "none",
"clients": [
{
"id": "${UUID}"
}
]
},
"streamSettings": {
"network":"ws",
"wsSettings": {
"path": "${WS_PATH}"
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}
EOF
v_config_pb=`./v2ctl config config.json | encode`
rm config.json
# Creat start.sh and then encrypt it with shc
cat > start.sh << EOF
#!/bin/sh
p_config_pb="${v_config_pb}"
echo \$p_config_pb | base64 -di > config.pb
chmod 0755 ./v2ray
./v2ray -config=./config.pb >/dev/null 2>/dev/null&
sleep 5 ; rm ./config.pb
sleep 999d
EOF
export CFLAGS=-static
shc -r -f start.sh
rm start.sh.x.c start.sh
mv start.sh.x start