shadowsocks-rust
This is a port of shadowsocks.
shadowsocks is a fast tunnel proxy that helps you bypass firewalls.
Dependencies
- libcrypto (OpenSSL)
- libsodium (Required if you need ciphers that provided by libsodium)
Usage
crates.io
Install from crates.io:
then you can find sslocal
and ssserver
in $CARGO_HOME/bin
.
Build from source
Then sslocal
and ssserver
will appear in ./target
, it works similarly as the two binaries in
the official ShadowSocks' implementation.
Build standalone binaries
Requirements:
- Linux x86_64
- Docker
Then sslocal
, ssserver
and ssurl
will be packaged in ./build/shadowsocks-latest-release.x86_64-unknown-linux-musl.tar.gz
.
Read Cargo.toml
for more details.
Getting Started
Create a ShadowSocks' configuration file. Example
Detailed explaination could be found in shadowsocks' documentation.
In shadowsocks-rust, we also have an extended configuration file format, which is able to define more than one servers:
The sslocal
will use a load balancing algorithm to dispatch packages to all servers.
Start local and server ShadowSocks with
cargo run --bin sslocal -- -c config.json
cargo run --bin ssserver -- -c config.json
List all available arguments with -h
.
Supported Ciphers
aes-128-cfb
,aes-128-cfb1
,aes-128-cfb8
,aes-128-cfb128
aes-256-cfb
,aes-256-cfb1
,aes-256-cfb8
,aes-256-cfb128
rc4
,rc4-md5
chacha20
,salsa20
dummy
(No encryption, just for debugging)aes-128-gcm
,aes-192-gcm
,aes-256-gcm
Useful Tools
ssurl
is for encoding and decoding ShadowSocks URLs (SIP002). Example:
ss://YWVzLTI1Ni1jZmI6cGFzc3dvcmQ@127.0.0.1:8388/?plugin=obfs-local%3Bobfs%3Dhttp%3Bobfs-host%3Dwww.baidu.com
Notes
It supports the following features:
- Socks5 CONNECT command
- UDP ASSOCIATE command (partial)
- HTTP Proxy protocol Deprecated, use
privoxy
instead. - Various crypto algorithms
- Load balancing (multiple servers)
- SIP004 AEAD ciphers
- SIP003 Plugins
- SIP002 Extension ss URLs
TODO
- Documentation
- Extend configuration format
- Improved logging format (waiting for the new official log crate)
- Support more ciphers without depending on
libcrypto
(waiting for an acceptable Rust crypto lib implementation) - Windows support. (Depending on mio and coio-rs)
- Build with stable. (Depending on coio)
- Support HTTP Proxy protocol (it is easy to use another tools to convert HTTP proxy protocol to Socks5, like
privoxy
) - One-time Auth. (Already deprecated according to Shadowsocks' community)
- AEAD ciphers. (proposed in SIP004, still under discussion)
License
Copyright (c) 2014 Y. T. CHUNG
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.