Shadowsocks 协议
Shadowsocks 是由 @clowwindy 开发的经典代理协议,以其简单、高效、兼容性好的特点,成为全球用户最广泛使用的代理协议之一。
协议特点
- ⚡ 简单高效:协议设计简洁,性能优秀
- 🔐 多种加密:支持多种现代加密算法
- 🌍 兼容性极佳:几乎所有平台都有客户端支持
- 🚀 低延迟:协议开销小,响应速度快
- 📱 跨平台:支持所有主流操作系统和设备
配置示例
AEAD 加密(推荐)
json
{
"outbounds": [
{
"type": "shadowsocks",
"tag": "ss-out",
"server": "example.com",
"server_port": 8388,
"method": "aes-128-gcm",
"password": "your-password",
"network": "tcp"
}
]
}AEAD 加密 - 2022 版
json
{
"outbounds": [
{
"type": "shadowsocks",
"tag": "ss-2022-out",
"server": "example.com",
"server_port": 8388,
"method": "aes-256-gcm",
"password": "your-password",
"network": "tcp"
}
]
}UDP 支持
json
{
"outbounds": [
{
"type": "shadowsocks",
"tag": "ss-udp-out",
"server": "example.com",
"server_port": 8388,
"method": "aes-128-gcm",
"password": "your-password",
"network": "udp"
}
]
}多服务器负载均衡
json
{
"outbounds": [
{
"type": "shadowsocks",
"tag": "ss-1",
"server": "server1.example.com",
"server_port": 8388,
"method": "aes-128-gcm",
"password": "password1"
},
{
"type": "shadowsocks",
"tag": "ss-2",
"server": "server2.example.com",
"server_port": 8388,
"method": "aes-128-gcm",
"password": "password2"
},
{
"type": "urltest",
"tag": "auto",
"outbounds": ["ss-1", "ss-2"],
"url": "http://www.gstatic.com/generate_204",
"interval": 300
}
]
}加密方式选择
AEAD 加密(推荐)
| 加密算法 | 安全性 | 性能 | 推荐度 | 说明 |
|---|---|---|---|---|
| aes-128-gcm | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | 最佳平衡,推荐使用 |
| aes-192-gcm | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | 安全性更高 |
| aes-256-gcm | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | 最高安全性 |
| chacha20-ietf-poly1305 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | 移动设备友好 |
| xchacha20-ietf-poly1305 | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | 极高安全性 |
2022 版加密
| 加密算法 | 密钥长度 | 盐长度 | 推荐度 | 说明 |
|---|---|---|---|---|
| 2022-blake3-aes-128-gcm | 128位 | 16字节 | ⭐⭐⭐⭐⭐ | 现代标准,推荐 |
| 2022-blake3-aes-192-gcm | 192位 | 16字节 | ⭐⭐⭐⭐ | 平衡选择 |
| 2022-blake3-aes-256-gcm | 256位 | 16字节 | ⭐⭐⭐⭐ | 高安全性 |
| 2022-blake3-chacha20-ietf-poly1305 | 256位 | 16字节 | ⭐⭐⭐⭐⭐ | 移动设备友好 |
传统加密(不推荐)
| 加密算法 | 安全性 | 状态 | 说明 |
|---|---|---|---|
| aes-128-ctr | ⭐⭐⭐ | 已废弃 | 不安全,不推荐 |
| aes-192-ctr | ⭐⭐⭐ | 已废弃 | 不安全,不推荐 |
| aes-256-ctr | ⭐⭐⭐ | 已废弃 | 不安全,不推荐 |
| aes-128-cfb | ⭐⭐ | 已废弃 | 存在安全问题 |
| aes-192-cfb | ⭐⭐ | 已废弃 | 存在安全问题 |
| aes-256-cfb | ⭐⭐ | 已废弃 | 存在安全问题 |
高级配置
插件支持
json
{
"outbounds": [
{
"type": "shadowsocks",
"tag": "ss-obfs-out",
"server": "example.com",
"server_port": 8388,
"method": "aes-128-gcm",
"password": "your-password",
"plugin": "obfs-local",
"plugin_opts": "obfs=tls;obfs-host=www.bing.com"
}
]
}负载均衡
json
{
"outbounds": [
{
"type": "urltest",
"tag": "auto",
"outbounds": ["ss-1", "ss-2", "ss-3"],
"url": "http://www.gstatic.com/generate_204",
"interval": 300
}
]
}分组轮询
json
{
"outbounds": [
{
"type": "loadbalance",
"tag": "loadbalance-out",
"outbounds": ["ss-1", "ss-2"],
"strategy": "round-robin"
}
]
}使用场景
- 日常科学上网
- 移动设备代理
- 跨平台使用
- 需要简单稳定代理的场景
优缺点
优点
- 协议简单,配置容易
- 性能优秀,延迟低
- 兼容性最好,客户端丰富
- 社区支持完善,生态成熟
- 支持插件扩展功能
缺点
- 流量特征相对明显
- 在严格网络环境下可能被识别
- 缺乏内置的抗检测机制
- 需要搭配混淆插件使用
性能优化建议
服务器端
- 选择合适端口:避免使用常见端口
- 启用 BBR:提升 TCP 性能
- 多端口部署:分散流量负载
- 选择优质线路:确保网络质量
客户端端
- 选择合适加密:根据设备性能选择
- 启用 UDP:提升 DNS 和游戏体验
- 配置代理规则:避免国内流量走代理
- 优化 DNS:使用快速 DNS 服务器
安全建议
- 强密码:使用复杂密码,定期更换
- AEAD 加密:避免使用已废弃的传统加密
- 混淆插件:在严格网络环境下启用
- 端口策略:避免使用默认端口
- 访问控制:实施 IP 白名单
常见问题解决
连接失败
- 检查密码和加密方式
- 确认服务器地址和端口
- 验证防火墙设置
- 检查网络连接状态
速度慢
- 尝试不同加密方式
- 检查服务器负载
- 优化本地网络设置
- 使用负载均衡
DNS 解析问题
- 配置可靠的 DNS 服务器
- 避免使用运营商 DNS
- 考虑使用 DoH/DoT