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

Commit a29f25b

Browse files
committed
Merge pull request scrapinghub#37 from lins05/container-based-travis
Use container based travis builds
2 parents be62b92 + c6c5d0d commit a29f25b

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
sudo: false
12
language: python
23
python: 2.7
4+
cache:
5+
directories:
6+
- $HOME/.cache/pip
37
before_install:
4-
- sudo cp scripts/slackbot-test-ctl /usr/local/bin
8+
- mkdir -p $HOME/opt/local/bin
9+
- export PATH=$HOME/opt/local/bin:$PATH
10+
- pushd /tmp/ && git clone https://github.com/rofl0r/proxychains-ng.git && cd proxychains-ng && ./configure --prefix=$HOME/opt/local && make -j2 && make install && popd
11+
- pip install shadowsocks
12+
- cp scripts/slackbot-test-ctl $HOME/opt/local/bin
513
- slackbot-test-ctl init
614
- slackbot-test-ctl startproxy
715
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)