首先按此文:在linux vps上安装erlang 搭建erlang and rebar环境。
然后,
- git clone https://github.com/Yongke/shadowsocks-erlang
cd shadowsocks-erlangrebar compile
(rebar compile就是编译基于erlang的源码的命令)
这样
shadowsocks-erlang就编译好了。
(需先安装erlang和rebar,参见本文末尾)Erlang OTP(R16B01) and rebar are needed. crypto module in OTP improved a lot in R16B01, but unfortunately, the port which implement this module does not use EVP_* functions. Which means almost all the block cipher method is not compatible with other shadowsocks implementation. default and rc4 method works fine. - Client side
erl -smp auto -config ./local.config -pa ./ebin/ -boot start_sasl -s shadowsocks_app start -detached
- Server side
erl -smp auto -config ./remote.config -pa ./ebin/ -boot start_sasl -s shadowsocks_app start -detached
Configuration
- Config files
local.config, remote.config
- Descriptions
{shadowsocks,
[
{type, local},
{local_port,1080},
{server,"VPS_IP"},
{server_port,8488},
{password,"你自设的密码"},
{method,rc4}
]}
{type, local}
is for client side, {type, remote}
is for server side.
编辑remote.config如下:
...
{shadowsocks,
[
{type, remote},
{local_port,1080},
{server,"localhost"},
{server_port,8488},
{password,"你自设的密码"},
{method,rc4}
]}
...
然后运行:
erl -smp auto -config ./remote.config -pa ./ebin/ -boot start_sasl -s shadowsocks_app start -detached
这样,服务器端就搭建好了。
注意:method的值default一定要改为rc4.兼容任何shadowsocks客户端程序,不过加密方式要选择rc4.(在mac上可以使用shadowsocksX这个客户端。)
在mac里,也可像linux vps那样,把shadowsocks-erlang克隆下来,进行编译。当然你一样需先在mac上安装erlang环境和安装rebar.然后,
git clone https://github.com/Yongke/shadowsocks-erlang
cd shadowsocks-erlang
cd shadowsocks-erlang
yudeMacBook-Air:shadowsocks-erlang brite$ ls
README.md include log remote.config
ebin local.config rebar.conf src
yudeMacBook-Air:shadowsocks-erlang brite$ rebar compile
这样
shadowsocks-erlang就编译好了。编辑local.config文件如下:{shadowsocks, [ {type, local}, {local_port,1080}, {server,"VPS_IP"}, {server_port,8488}, {password,"你自设的密码"}, {method,rc4} ]}
erl -smp auto -config ./local.config -pa ./ebin/ -boot start_sasl -s shadowsocks_app start -detached
yudeMacBook-Air:shadowsocks-erlang brite$ lsof -i:1080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 57691 brite 13u IPv4 0x352e3a321ea1a93 0t0 TCP *:socks (LISTEN)
(beam.smp,即erl在监听1080端口,说明erl -smp auto -config ./local.config -pa ./ebin/ -boot start_sasl -s shadowsocks_app start -detached运行成功。
yudeMacBook-Air:shadowsocks-erlang brite$
然后设置浏览器的socks5代理为127.0。0.1:1080,即可翻墙。
from https://github.com/Yongke/shadowsocks-erlang
(以上蓝色字体内容系我所写)
-----------
使用后,感觉shadowsocks的erlang语言版比shadowsocks的python语言版要robust和快速得多!