-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·65 lines (44 loc) · 1.58 KB
/
bootstrap
File metadata and controls
executable file
·65 lines (44 loc) · 1.58 KB
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
#!/bin/bash
. /usr/local/bin/kcp_ss_lib
start_container(){
CONTAINER_ID=$(get_docker_container_id)
echo "Current container: $CONTAINER_ID"
IMAGE_NAME=$(get_docker_image_name $CONTAINER_ID)
echo "Current image: $IMAGE_NAME"
INTERFACE=${INTERFACE:-$(get_default_network_interface)}
echo "Network interface: $INTERFACE"
HOST=${HOST:-$(get_default_network_ip)}
echo "Host name: $HOST"
# SS_PORT=${SS_PORT:-$(find_available_port tcp 5000 20000)}
# echo "Exported Shadowsocks port: $SS_PORT"
# KCPTUN_PORT=${KCPTUN_PORT:-$(find_available_port udp 5000 20000)}
# echo "Exported KCPTUN port: $KCPTUN_PORT"
# if [ $SS_PORT -eq $KCPTUN_PORT ]; then
# echo "ERROR: SS_PORT $SS_PORT is equal to KCPTUN_PORT $KCPTUN_PORT." >&2
# exit 1
# fi
# PASSWORD=${PASSWORD:-$(pwgen 8 1)}
# echo "Password: $PASSWORD"
# SS_METHOD=${SS_METHOD:-aes-256-cfb}
# echo "Shadowsocks method: $SS_METHOD"
# KCPTUN_CRYPT=${KCPTUN_CRYPT:-aes}
# echo "KCPTUN crypt: $KCPTUN_CRYPT"
# KCPTUN_MODE=${KCPTUN_MODE:-normal}
# echo "KCPTUN mode: $KCPTUN_MODE"
setup_bootstrap_envs
echo
COMMAND_LINE=$(generate_dood_command \
$IMAGE_NAME $HOST $SS_PORT $PASSWORD $KCPTUN_PORT $PASSWORD $SS_METHOD $KCPTUN_CRYPT $KCPTUN_MODE)
echo $COMMAND_LINE
echo
WORKER_CONTAINER_ID=$($COMMAND_LINE)
echo "Worker container: $WORKER_CONTAINER_ID"
WORKER_CONTAINER_NAME=$(docker inspect -f '{{.Name}}' $WORKER_CONTAINER_ID|tail -c +2)
echo "Worker container name: $WORKER_CONTAINER_NAME"
echo
echo "----"
echo
docker exec -i $WORKER_CONTAINER_ID show
}
# test_all
start_container