-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
48 lines (42 loc) · 1.2 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
#!/bin/bash
SS_CONFIG=${SS_CONFIG:-""}
SS_MODULE=${SS_MODULE:-"ss-server"}
KCP_CONFIG=${KCP_CONFIG:-""}
KCP_MODULE=${KCP_MODULE:-"kcpserver"}
KCP_FLAG=${KCP_FLAG:-"false"}
RNGD_FLAG=${RNGD_FLAG:-"false"}
while getopts "s:m:k:e:xr" OPT; do
case $OPT in
s)
SS_CONFIG=$OPTARG;;
m)
SS_MODULE=$OPTARG;;
k)
KCP_CONFIG=$OPTARG;;
e)
KCP_MODULE=$OPTARG;;
x)
KCP_FLAG="true";;
r)
RNGD_FLAG="true";;
esac
done
if [ "${RNGD_FLAG}" == "true" ]; then
echo -e "\033[32mUse /dev/urandom to quickly generate high-quality random numbers......\033[0m"
rngd -r /dev/urandom
fi
if [ "${KCP_FLAG}" == "true" ] && [ "${KCP_CONFIG}" != "" ]; then
echo -e "\033[32mStarting kcptun......\033[0m"
${KCP_MODULE} ${KCP_CONFIG} 2>&1 &
else
echo -e "\033[33mKcptun not started......\033[0m"
fi
if [ "${SS_CONFIG}" != "" ]; then
echo -e "\033[32mStarting shadowsocks......\033[0m"
${SS_MODULE} ${SS_CONFIG}
else
echo -e "\033[31mError: SS_CONFIG is blank!\033[0m"
exit 1
fi
ss-server -s 0.0.0.0 -p 6443 -m chacha20 -k test123 --fast-open
kcpserver -t 127.0.0.1:6443 -l :6500 -mode fast2