PythonTip >> 博文 >> python

开源的代理程序:shadowsocks

zihua 2014-01-20 23:01:13 点击: 1157 | 收藏


shadowsocks是一款开源的代理程序,使用Python编写,经测试,其效果非常好,这里介绍一下安装方法。

项目主页:https://github.com/clowwindy/shadowsocks

安装前请更新python至2.6或者2.7版,更新方法见此

1,安装Python并发框架 Gevent

Gevent依赖libevent和greenlet,需要分别安装。

yum install libevent libevent-devel

wget -q http://peak.telecommunity.com/dist/ez_setup.py
python ./ez_setup.py
easy_install greenlet

wget http://pypi.python.org/packages/source/g/gevent/gevent-0.13.6.tar.gz#md5=7c836ce2315d44ba0af6134efbcd38c9
tar -xzvf gevent-0.13.6.tar.gz
cd gevent-0.13.6/
python setup.py install

2,安装Python加密库 M2Crypto

wget http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.21.1.tar.gz#md5=f93d8462ff7646397a9f77a2fe602d17
tar -zxvf M2Crypto-0.21.1.tar.gz 
cd M2Crypto-0.21.1
python setup.py install

可能出现问题1:error: command ‘gcc’ failed with exit status 1

解决:yum install python-devel

可能出现问题2:

unable to execute swig: No such file or directory

error: command ‘swig’ failed with exit status 1

解决:yum install swig

可能出现问题3:

Error: /usr/include/openssl/opensslconf.h:13: Error: Unable to find ‘opensslconf-i386.h’

error: command ‘swig’ failed with exit status 1

解决:cp /usr/include/openssl/opensslconf-i386.h ./

3,服务端设置

下载shadowsocks主程序并解压

wget https://github.com/clowwindy/shadowsocks/archive/master.zip
unzip master
cd shadowsocks-master/

编辑主配置文件

vim config.json  格式如下,其它的不多说了,method表示使用M2Crypto加密
{
    "server":"公网IP地址",
    "server_port":8388,
    "local_port":1080,
    "password":"密码",
    "timeout":600,
    "method":"bf-cfb"
}

运行程序

nohup python server.py > log &

不出意外,程序已经在8388端口兼听了。

4,客户端设置

下载由feijilei同学编绎好的客户端程序

编辑config.json,配置项跟服务端一样即可。

运行local.exe,即可。如果窗口一闪而过,说明config.json未配置正确或者server端无法连接。

在浏览器里设置socks5代理为127.0.0.1,端口为1080,已经可以上网了。

各位亲,在转载这篇文章的时候,不要加上我的链接,哥现在没法肉身出墙,还想在墙内多活几年呢!

原文链接:http://www.wumii.com/item/Gz3C1woC

作者:zihua | 分类: python | 标签: python | 阅读: 1157 | 发布于: 2014-01-20 23时 |