====== ShadowSocks ======
[[wp>Shadowsocks|ShadowSocks]]是[[https://github.com/clowwindy|clowwindy]]编写的socks5加密代理/协议,含有多种协议实现,能用在几乎所有大众网络设备上(手机,电脑,路由器)。
===== 服务端选择 =====
个人建议使用[[https://github.com/shadowsocks/shadowsocks-libev|shadowsocks-libev]]作为服务端,好处是支持中转UDP包。
[[https://github.com/shadowsocks/shadowsocks-go|shadowsocks-go]]作为备用,好处是据说有黑科技。
===== 客户端端选择 =====
==== Linux ====
''Archlinux''直接安装''aur''上的''shadowsocks-libev'',也可自行编译:
yaourt -S aur/shadowsocks-libev
==== Windows ====
Windows上建议使用[[https://github.com/shadowsocks/shadowsocks-csharp|shadowsocks-csharp]],采用原生''C#''编写,使用简单方便,而且最新版本已经支持UDP转发。
==== Android ====
[[https://play.google.com/store/apps/details?id=com.github.shadowsocks|Google Play versoin]]
Android版本有两种模式:Root模式和VPN模式,Android 5.0+系统建议使用VPN模式(无须Root即可使用)
==== OpenWRT ====
[[https://github.com/shadowsocks/openwrt-shadowsocks|openwrt-shadowsocks]]
直接下载预编译包即可,能通过配置实现透明代理
===== Optimization =====
==== sysctl ====
优化sysctl参数,创建、编辑 ''/etc/sysctl.d/10-shadowsocks.conf'' 文件:
# max open files
fs.file-max = 51200
# max read buffer
net.core.rmem_max = 67108864
# max write buffer
net.core.wmem_max = 67108864
# default read buffer
net.core.rmem_default = 65536
# default write buffer
net.core.wmem_default = 65536
# max processor input queue
net.core.netdev_max_backlog = 4096
# max backlog
net.core.somaxconn = 4096
# resist SYN flood attacks
net.ipv4.tcp_syncookies = 1
# reuse timewait sockets when safe
net.ipv4.tcp_tw_reuse = 1
# turn off fast timewait sockets recycling
net.ipv4.tcp_tw_recycle = 0
# short FIN timeout
net.ipv4.tcp_fin_timeout = 30
# short keepalive time
net.ipv4.tcp_keepalive_time = 1200
# outbound port range
net.ipv4.ip_local_port_range = 10000 65000
# max SYN backlog
net.ipv4.tcp_max_syn_backlog = 4096
# max timewait sockets held by system simultaneously
net.ipv4.tcp_max_tw_buckets = 5000
# turn on TCP Fast Open on both client and server side
net.ipv4.tcp_fastopen = 3
# TCP receive buffer
net.ipv4.tcp_rmem = 4096 87380 67108864
# TCP write buffer
net.ipv4.tcp_wmem = 4096 65536 67108864
# turn on path MTU discovery
net.ipv4.tcp_mtu_probing = 1
# for high-latency network
net.ipv4.tcp_congestion_control = hybla
# for low-latency network, use cubic instead
#net.ipv4.tcp_congestion_control = cubic
重新载入sysctl:
sudo sysctl --system
----
====== Reference ======
* [[https://github.com/shadowsocks/shadowsocks/wiki/Optimizing-Shadowsocks|Optimizing Shadowsocks]]