Skip to content
This repository was archived by the owner on Jul 2, 2019. It is now read-only.

Commit 68b8e7d

Browse files
committed
use proxychains instead of tsocks for reconnecting tests
1 parent c286289 commit 68b8e7d

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

.travis.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
sudo: false
22
language: python
33
python: 2.7
4-
addons:
5-
apt:
6-
packages:
7-
- tsocks
84
before_install:
9-
- export PATH=$HOME/bin:$PATH
10-
- cp scripts/slackbot-test-ctl $HOME/bin
5+
- mkdir -p $HOME/opt/local/bin
6+
- export PATH=$HOME/opt/local/bin:$PATH
7+
- pushd /tmp/ && git clone https://github.com/rofl0r/proxychains-ng.git && cd proxychains-ng && ./configure --prefix=$HOME/opt/local && make -j2 && make install && popd
118
- pip install shadowsocks
9+
- cp scripts/slackbot-test-ctl $HOME/opt/local/bin
1210
- slackbot-test-ctl init
1311
- slackbot-test-ctl startproxy
1412
install: pip install -r requirements.txt

scripts/slackbot-test-ctl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
set -x -e
44

55
ssconfig=/tmp/config.json
6-
tsocksconfig=/tmp/tsocks.conf
7-
export TSOCKS_CONF_FILE=$tsocksconfig
6+
proxychainsconfig=/tmp/proxychains.conf
87

9-
init_tsocks() {
8+
init_proxychains() {
109
cat >$ssconfig <<EOF
1110
{
1211
"server":"127.0.0.1",
@@ -19,21 +18,23 @@ init_tsocks() {
1918
}
2019
EOF
2120

22-
cat >$tsocksconfig <<EOF
23-
local = 127.0.0.0/255.0.0.0
24-
server = 127.0.0.1
25-
server_type = 5
26-
server_port = 1800
21+
cat >$proxychainsconfig <<EOF
22+
strict_chain
23+
quiet_mode
24+
proxy_dns
25+
remote_dns_subnet 224
26+
tcp_read_time_out 15000
27+
tcp_connect_time_out 8000
28+
[ProxyList]
29+
socks5 127.0.0.1 1800
2730
EOF
2831
}
2932

3033
main() {
3134
local action=$1; shift
3235
case $action in
3336
init)
34-
which sslocal || sudo pip install shadowsocks
35-
which tsocks || sudo apt-get install tsocks
36-
init_tsocks
37+
init_proxychains
3738
;;
3839
startproxy)
3940
pgrep -f "sslocal -c $ssconfig" || {
@@ -48,7 +49,7 @@ main() {
4849
pkill -f "ssserver -c $ssconfig"
4950
;;
5051
run)
51-
tsocks "$@"
52+
proxychains4 -f $proxychainsconfig "$@"
5253
;;
5354
*)
5455
echo "WARNING: unknown command $action"

0 commit comments

Comments
 (0)