-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsslocal.sh
executable file
·118 lines (110 loc) · 3.51 KB
/
sslocal.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
#default value for local port
local_port=1080
#default value for cipher method
method="aes-256-cfb"
#default value for server port
server_port=8388
local_address="127.0.0.1"
time_out=600
#parse the parameters
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "A fast tunnel proxy that helps you bypass firewalls."
echo "You can supply configurations via either config file or command line arguments."
echo "Proxy options:"
echo " -c CONFIG path to config file"
echo " -s SERVER_ADDR server address"
echo " -p SERVER_PORT server port, default: 8388"
echo " -b LOCAL_ADDR local binding address, default: 127.0.0.1"
echo " -l LOCAL_PORT local port, default: 1080"
echo " -k PASSWORD password"
echo " -m METHOD encryption method, default: aes-256-cfb"
echo " Sodium:"
echo " chacha20, chacha20-ietf."
echo " OpenSSL:"
echo " aes-{128|192|256}-cfb,aes-{128|192|256}-ofb,"
echo " -t TIMEOUT timeout in seconds, default: 600"
exit 0
;;
-c)
shift
if test $# -gt 0; then
config=$1
fi
shift
;;
-s)
shift
if test $# -gt 0; then
server=$1
fi
shift
;;
-p)
shift
if test $# -gt 0; then
server_port=$1
fi
shift
;;
-b)
shift
if test $# -gt 0; then
local_address=$1
fi
shift
;;
-l)
shift
if test $# -gt 0; then
local_port=$1
fi
shift
;;
-k)
shift
if test $# -gt 0; then
password=$1
fi
shift
;;
-m)
shift
if test $# -gt 0; then
method=$1
fi
shift
;;
-t)
shift
if test $# -gt 0; then
time_out=$1
fi
shift
;;
*)
break
;;
esac
done
main="LocalMain"
#printing some output to the users
echo "config: $config"
if [ -n "$config" ]
then
echo "Starting shadowsocks ...";
java -jar -jar ./target/shadowsocks-java-1.0-SNAPSHOT.jar ${main} config=${config}
elif [ -z "$server" ]
then
echo "please set a server address"
exit 0
elif [ -z "$password" ]
then
echo "please set a password"
exit 0
else
java -jar ./target/shadowsocks-java-1.0-SNAPSHOT.jar ${main} server=${server} server_port=${server_port}
local_address=${local_address} local_port=${local_port} method=${method} password=${password}
fi