Skip to content

ShadowsocksR — sing-box

sing-box 实现 SSR 客户端侧。不支持入站 —— 服务端请使用 SSR 专用 实现(ShadowsocksR-libev 或其分支)。

出站

type: "shadowsocksr"

字段类型默认值允许值描述
methodstring(required)aes-256-cfb | aes-128-ctr | chacha20-ietf | rc4-md5 | <other SSR ciphers>SSR 加密算法。可接受集合是历史 SSR 加密目录 —— RC4、AES-CFB、AES-CTR、ChaCha20 等。现代 AEAD 加密属于常规 Shadowsocks 出站。
passwordstring(required)<string>服务端密码。
obfsstring(unset)plain | http_simple | http_post | random_head | tls1.2_ticket_auth混淆插件。`plain` 无混淆;`http_simple` 与 `http_post` 发出伪造 HTTP 请求;`tls1.2_ticket_auth` 模拟 TLS 复用。
obfs_paramstring(unset)<string>插件参数。对 HTTP obfs 而言是 Host 头。
protocolstringoriginorigin | auth_aes128_md5 | auth_aes128_sha1 | auth_sha1_v4 | auth_chain_a | auth_chain_b协议层插件。`origin` 无插件;`auth_*` 家族每包带鉴权。
protocol_paramstring(unset)<string>协议层参数。许多插件用作用户数或限速提示。
networkNetworkList(tcp+udp)tcp | udp | 限定为仅 TCP 或仅 UDP。

源码: option/shadowsocksr.go:3-13 · 锚定版本 v1.13.11 (553cfa1)

内嵌 DialerOptionsServerOptions

示例

带 HTTP obfs 的纯 SSR:

json
{
  "outbounds": [
    {
      "type": "shadowsocksr",
      "tag": "ssr-out",
      "server": "example.com",
      "server_port": 443,
      "method": "aes-256-cfb",
      "password": "<password>",
      "obfs": "http_simple",
      "obfs_param": "www.bing.com",
      "protocol": "auth_chain_a",
      "protocol_param": "32"
    }
  ]
}

TLS-ticket-auth obfs:

json
{
  "outbounds": [
    {
      "type": "shadowsocksr",
      "server": "example.com",
      "server_port": 443,
      "method": "chacha20-ietf",
      "password": "<password>",
      "obfs": "tls1.2_ticket_auth",
      "obfs_param": "www.bing.com",
      "protocol": "auth_chain_b"
    }
  ]
}

说明

  • 仅客户端。若要跑 SSR 服务端,需要专用 SSR 守护进程 —— sing-box 的 shadowsocksr 出站没有同名的入站类型与之配对。
  • methodobfsprotocol 接受的字符串是历史 SSR 目录。「现代」 Shadowsocks 加密(AEAD、2022-blake3-*)应放在 Shadowsocks 出站
  • auth_chain_* 协议插件是今天仍在活跃使用的;旧的 auth_aes128_*auth_sha1_v4 变体因 2018 年发现的重放攻击类 漏洞已不安全。

跨内核说明

  • Xray-core 不支持 SSR。参见 SSR — Xray-core
  • mihomo 使用 cipher(而非 method)以及参数字段的 kebab-case 形式(obfs-paramprotocol-param)。参见 SSR — mihomo

源码: option/shadowsocksr.go:3-13 · v1.13.11 (553cfa1)

由 Argsment 出品的 Core Tutorial