shadowsocks-libev
config
ss-server -s 0.0.0.0 -p 443 -u -m chacha20-ietf-poly1305 -k password --fast-open
参数:
- --acl ACL_FILE_PATH
Config file
-c config_file_path 参数指定。
{
"server":"0.0.0.0",
"acl":"/etc/shadowsocks-libev/config.acl",
"mode":"tcp_and_udp",
"server_port":21,
"local_port":1080,
"password":"password",
"timeout":86400,
"method":"chacha20-ietf-poly1305"
}
-u, --fast-open, --acl 等参数无法通过配置文件指定。
initscript
systemd
vim /etc/default/shadowsocks-libev
START=yes
# Configuration file
CONFFILE="/etc/shadowsocks-libev/config.json"
# Extra command line arguments
DAEMON_ARGS="-u"
# User and group to run the server as
USER=nobody
GROUP=nogroup
# Number of maximum file descriptors
MAXFD=32768
init.d
initscript 配置文件:/etc/default/shadowsocks-libev
# Defaults for shadowsocks initscript
# sourced by /etc/init.d/shadowsocks-libev
# installed at /etc/default/shadowsocks-libev by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Note: `START', `GROUP' and `MAXFD' options are not recognized by systemd.
# Please change those settings in the corresponding systemd unit file.
# Enable during startup?
START=yes
# Configuration file
CONFFILE="/etc/shadowsocks-libev/config.json"
# Extra command line arguments
DAEMON_ARGS="-u"
# User and group to run the server as
USER=root
GROUP=root
# Number of maximum file descriptors
MAXFD=1024
Tips
"block all requests from X.X.X.X" error
这是auto ban机制,一个IP多次连接失败就会被(永久)ban,只有重启server服务器才行解封。
Fix:
Add your IP to the [white_list] section of the ACL file.
ACL
启动 ss-server 时用 --acl <acl_file>
参数指定 acl 文件路径。
ACL 文件格式:
#[accept_all]
# 除黑名单IP外,允许所有IP连接。(默认模式)
[reject_all]
# 拒绝所有IP 连接 (除了[white_list]白名单里的IP)
[black_list]
# 黑名单 IP
[white_list]
# IP白名单。在启用了 [reject_all] 的模式下,只有这里IP能够连接。
# 另外,白名单里的IP不会因为多次尝试连接失败而被自动封禁。
127.0.0.1
::1
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
fc00::/7
[outbound_block_list]
# 禁止访问列表
(^|\.)\w*adwords\w*\.\w*$
[bypass_all]
# 直连所有IP模式 (适用于 ss-local 的配置)
[proxy_all]
# 代理所有IP模式 (适用于 ss-local 的配置)
[bypass_list]
#直连列表 (适用于 ss-local 的配置)
[proxy_list]
#代理列表 (适用于 ss-local 的配置)
- black_list / white_list 每一条记录是一个 IP 或 IP段。
- outbound_block_list / bypass_list / proxy_list 每一条是IP、IP段或用来匹配域名的正则表达式。
- 参考: acl.c
Docker
- shadowsocks/shadowsocks-libev (Official ?) (容器内ss默认监听 8388 端口)
- mritd/shadowsocks
docker pull shadowsocks/shadowsocks-libev:edge
docker run -e PASSWORD=123456 -e METHOD=chacha20-ietf-poly1305 \
-p 80:8388 -p 80:8388/udp \
--restart always --name ss-server -d \
shadowsocks/shadowsocks-libev:edge
shadowsocks-windows
特点:在同一端口(默认 1080) 同时提供 Socket5 和 http(s) 代理。
Problems
访问个别站(例如GETCHU)会很卡,但改用同一IP的VPN就正常
Workaround:用 Socket5代理,不要用 http(s)代理。
shadowsocks-win 自动设置的系统代理只能设为 http。如果需要使用 Socket5 模式代理,可以:
- 安装 Chrome SwitchyOmega 扩展并使用其管理 Chrome 代理设置。
- 使用 Proxifier 强制任何 Win32 程序使用 Socket5 代理。