Total Pageviews

Wednesday 28 June 2017

搭建socks5代理服务器程序-socks5

A socks5 implementation written using libuv.

git clone https://github.com/neevek/socks5
cd socks5 
mkdir build 
cd build
cmake ..

root@localhost:~/socks5/build# ls
bin  CMakeCache.txt  CMakeFiles  cmake_install.cmake  Makefile
root@localhost:~/socks5/build# make
root@localhost:~/socks5/build# ls bin
socks5

(bin目录里生成了可执行文件socks5
root@localhost:~/socks5/build# cd bin
root@localhost:~/socks5/build/bin# ./socks5 -h 0.0.0.0 -p 24570
(这样,这个socks5代理服务器程序-socks5就运行起来了。它所监听的端口号为24570)
root@localhost:~/socks5/build/bin# ps aux|grep socks5
root      4150  0.0  0.0  11740   900 pts/4    S+   07:29   0:00 grep socks5
root     15888  0.0  0.2 315788  2188 ?        Ssl  Jun27   0:02 ./socks5 -h 0.0.0.0 -p 24570
root@localhost:~/socks5/build/bin#


项目地址:https://github.com/neevek/socks5 

这个socks5代理服务器程序是明文代理,但可以用来翻墙设置浏览器的socks5代理服务器地址为

vps-ip, 端口:24570 ,浏览器即可翻墙。

新建/etc/init.d/socks5-by-neevek脚本,内容为:
#!/bin/bash

### BEGIN INIT INFO
# Provides: socks5-by-neevek
# Required-Start: $remote_fs $local_fs
# Required-Stop: $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: use it to cross gfw
# Description: try it
### END INIT INFO

/root/socks5/build/bin/socks5 -h 0.0.0.0 -p 24570 

exit 0

然后,
chmod 755 /etc/init.d/socks5-by-neevek
update-rc.d socks5-by-neevek defaults
这样,命令:/root/socks5/build/bin/socks5 -h 0.0.0.0 -p 24570 就会随vps的启动而自动运行。


当然也可以搭配stunnel/obfsproxy来翻墙。
详见:
http://briteming.blogspot.com/2012/01/vpsstunnel.html
briteming.blogspot.com/2016/03/obfsproxysockshttp.html

只是在socks代理服务器程序外面套一个stunnel/obfsproxy来翻墙,翻墙速度刚开始有点慢,10多分钟后就变得很快了。

No comments:

Post a Comment