shadowsocks-ex is a elixir port of shadowsocks
A fast tunnel proxy that helps you bypass firewalls.
Features:
- TCP support
- UDP support (only server)
- Client support
- Server support
- OTA support
- Mulit user support
- Transparent Proxy Client support
- Anti protocol detection
Encryption methods
- rc4-md5
- aes-128-cfb
- aes-192-cfb
- aes-256-cfb
- aes-128-ctr
- aes-192-ctr
- aes-256-ctr
The package can be installed
by adding shadowsocks to your list of dependencies in mix.exs:
def deps do
[{:shadowsocks, "~> 0.3"}]
endThe online docs can be found at https://hexdocs.pm/shadowsocks.
Shadowsocks.start(args)the args is a keyword list, fields:
-
typerequiredatom- the connection type,:clientor:serveror custom module nameThere are currently four built-in
type:Shadowsocks.Conn.Client- general client, alias is:clientShadowsocks.Conn.Server- general server, alias is:serverShadowsocks.Conn.TransparentClient- transparent client, perfect with iptablesShadowsocks.Conn.HTTP302- redirect any http get request to:redirect_url, otherwise drop connections
-
portrequiredinteger- listen port -
ipoptionaltuple- listen ip, example:{127,0,0,1} -
methodoptionalstring- encode method, default:"rc4-md5" -
passwordrequiredstring- encode password -
otaoptionalbool- is force open one time auth, default:false -
serveroptionaltuple- required iftypeis:client, example:{"la.ss.org", 8388} -
udpoptionalbool- enable udp relay (experimental only support server side)
Shadowsocks.stop(port)stop listener by listen port, always return :ok
Shadowsocks.update(port, args)the args is a keyword list, see Shadowsocks.start/1 method
config :shadowsocks, :listeners,
[
[
type: :server,
method: "aes-192-cfb",
password: "pass",
port: 8888,
ota: true,
ip: {127, 0, 0, 1}
],
[
type: Shadowsocks.Conn.Http302,
method: "rc4-md5",
password: "pass",
port: 8889,
ota: false,
ip: {0, 0, 0, 0},
redirect_url: "http://ionet.cc"
],
[
type: :client,
method: "aes-192-cfb",
password: "pass",
server: {"localhost", 8888},
port: 1080,
ota: true,
ip: {127, 0, 0, 1}
],
]config :shadowsocks, :report,
port_min_flow: 5 * 1024 * 1024, # report flow when cached flow exceed :port_min_flow
port_min_time: 60 * 1000, # report flow when cached flow after :port_min_time
conn_min_flow: 5 * 1024 * 1024 # send flow to listener when cached flow exceed :conn_min_flow
config :shadowsocks, :protocol,
recv_timeout: 180000, # timeout for receive header
anti_max_time: 10000, # anti max delay time (ms), random sleep time before close connection
anti_max_bytes: 500, # anti max reply bytes, random bytes send to client
anti_detect: true # on / off anti protocol detectionEvent name: Shadowsocks.Event
events:
{:port, :open, port} # when start listener on port
{:conn, :open, {port, pid, addr}} # when received connection request
{:conn, :close, {port, pid, reason, flow}} # when connection process exited
{:conn, :connect, {port, pid, {ret, addr, port}}} # connect to remote addr result
{:port, :flow, {port, down, up}} # flow report on the port