-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·63 lines (54 loc) · 1.3 KB
/
docker-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
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
set -e
if [ -z "${PASSWORD}" ]; then
PASSWORD=`tr -dc A-Za-z0-9 </dev/urandom | head -c 16`
fi
if [ ! -z "${OBFS}" ]; then
if [ "${OBFS}" == "http" ]; then
PLUGIN="obfs-server"
PLUGIN_OPTS="obfs=http"
fi
if [ "${OBFS}" == "tls" ]; then
PLUGIN="obfs-server"
PLUGIN_OPTS="obfs=tls"
fi
if [ "${OBFS}" == "ws" ]; then
PLUGIN="v2ray-plugin"
PLUGIN_OPTS="server"
fi
if [ "${OBFS}" == "wss" ]; then
PLUGIN="v2ray-plugin"
PLUGIN_OPTS="server;tls"
fi
if [ "${OBFS}" == "quic" ]; then
PLUGIN="v2ray-plugin"
PLUGIN_OPTS="server;mode=quic"
fi
fi
SERVER_PLUGIN=""
if [ ! -z "${PLUGIN}" ]; then
SERVER_PLUGIN="--plugin ${PLUGIN} --plugin-opts ${PLUGIN_OPTS}"
fi
echo ""
echo -e "\033[32m [!] Server Port:\033[0m ${SERVER_PORT}"
echo -e "\033[32m [!] Encryption Method:\033[0m ${METHOD}"
echo -e "\033[32m [!] Password:\033[0m ${PASSWORD}"
echo -e "\033[32m [!] DNS Server:\033[0m ${DNS}"
if [ ! -z "${OBFS}" ]; then
echo -e "\033[32m [!] Plugin:\033[0m ${OBFS}"
fi
echo -e '\033[32m [+] Enjoy :)\033[0m'
echo ""
ss-server \
-s ${SERVER_ADDR} \
-p ${SERVER_PORT} \
-k ${PASSWORD} \
-m ${METHOD} \
-t ${TIMEOUT} \
-d ${DNS} \
-u \
--fast-open \
--reuse-port \
--no-delay \
${SERVER_PLUGIN} \
"$@"