Skip to content

Shadowsocks — Xray-core ​

Xray-core supports both classic AEAD-Shadowsocks (AES-GCM, (X)ChaCha20-Poly1305) and Shadowsocks-2022 (2022-blake3-... ciphers); both serve several users on one port, and SS-2022 adds EIH-based relaying. A deprecation banner is printed on load — Xray's developers recommend VLESS encryption as the modern alternative.

Inbound ​

settings for an inbound of "protocol": "shadowsocks":

FieldTypeDefaultAllowed valuesDescription
methodstring(required)aes-128-gcm | aes-256-gcm | chacha20-poly1305 | xchacha20-poly1305 | 2022-blake3-aes-128-gcm | 2022-blake3-aes-256-gcm | 2022-blake3-chacha20-poly1305Cipher (case-insensitive). A 2022-blake3-… value selects Shadowsocks-2022. The classic ciphers also accept the aead_… aliases (aead_aes_128_gcm, etc.) and chacha20-ietf-poly1305 / xchacha20-ietf-poly1305; there is no unencrypted none / plain method. Unknown values fail at startup. With classic per-user clients, each user sets its own method.
passwordstring(required; ignored with classic clients)<string> | <base64 key>Single-user password (classic AEAD), or the server key (SS-2022 — also required together with clients, in multi-user and relay mode). For SS-2022 the value is a base64-encoded key whose decoded length matches the cipher (16 / 32 bytes).
levelbyte0<byte>Policy level of the single-user account; users in clients carry their own level.
emailstring(unset)<string>Tag in stats/logs.
users[]*ShadowsocksUserConfig—[ShadowsocksUserConfig] | …Inbound account list; same object shape as clients. Either key is accepted.
clients[]*ShadowsocksUserConfig[][ShadowsocksUserConfig]Per-user list — both families serve several users on one port. Classic AEAD: each entry has its own method and password, and the top-level password is ignored. SS-2022: entries hold user keys under the top-level server method / password (AES ciphers only); if the first entry has an address, the inbound becomes a relay instead (see the tip below).
network*NetworkListtcptcp | udp | tcp,udpComma-separated list (or single value) of supported transports.

Source: infra/conf/shadowsocks.go:39-47 · pinned at v26.11.9 (676eaf6)

clients[] ​

FieldTypeDefaultAllowed valuesDescription
methodstring(see description)<classic AEAD cipher> | (empty for SS-2022)Classic AEAD: required — this user's cipher (aes-128-gcm, aes-256-gcm, chacha20-poly1305 or xchacha20-poly1305). SS-2022: must be empty — the server method applies; a non-empty value fails at startup.
passwordstring(required)<string> | <base64 key>Classic AEAD: this user's password. SS-2022: this user's key (base64, decoded length matching the server cipher — 16 or 32 bytes); in relay mode, the key of the destination server reached through address / port.
levelbyte0<byte>Policy level for this user.
emailstring(unset)<string>User identifier.
address*Address(unset)<host>SS-2022 relay only — the destination server for this entry. An address on the first entry turns the inbound into a relay, and then every entry needs one.
portuint16(unset)<port>Relay-target port (paired with address).

Source: infra/conf/shadowsocks.go:30-37 · pinned at v26.11.9 (676eaf6)

Multi-user and relay

  • Classic AEAD: every clients[] entry needs its own method and password; the top-level password is then ignored.
  • SS-2022: clients[] entries carry user keys and an empty method, under the top-level server method / password; only the 2022-blake3-aes-*-gcm ciphers allow it. If the first entry has an address, the inbound becomes a relay: every entry then needs address / port, and its password is the key of that destination server.
  • Clients of a multi-user SS-2022 server set password to <server key>:<user key>.

Outbound ​

settings for an outbound of "protocol": "shadowsocks":

FieldTypeDefaultAllowed valuesDescription
address*Address(unset)<host>Simplified shape — server hostname or IP.
portuint16(required with address)<port>Server port.
levelbyte0<byte>User level.
emailstring(unset)<string>User identifier.
methodstring(required)<see inbound methods>Cipher used to talk to the server.
passwordstring(required)<string> | <base64 key> | <key>:<key>Server password / SS-2022 key. For a multi-user SS-2022 server, join the keys with : in hop order (e.g. <server key>:<user key>). 2022-blake3-chacha20-poly1305 accepts a single key only.
servers[]*ShadowsocksServerTarget(use simplified shape)[ShadowsocksServerTarget]Verbose shape, exactly one entry.

Source: infra/conf/shadowsocks.go:189-197 · pinned at v26.11.9 (676eaf6)

servers[] ​

FieldTypeDefaultAllowed valuesDescription
address*Address(required)<host>Server hostname or IP.
portuint16(required)<port>Server port.
levelbyte0<byte>User level.
emailstring(unset)<string>User identifier.
methodstring(required)<cipher>Cipher.
passwordstring(required)<string> | <base64 key>Password / SS-2022 key — same format as the top-level password.

Source: infra/conf/shadowsocks.go:180-187 · pinned at v26.11.9 (676eaf6)

The outbound accepts either the simplified shape (top-level address, port, method, password) or the verbose servers shape with exactly one entry.

Examples ​

Classic AEAD inbound:

json
{
  "inbounds": [
    {
      "tag": "ss-in",
      "listen": "0.0.0.0",
      "port": 8388,
      "protocol": "shadowsocks",
      "settings": {
        "method": "aes-256-gcm",
        "password": "<password>",
        "network": "tcp,udp"
      }
    }
  ]
}

SS-2022 inbound with two users:

json
{
  "inbounds": [
    {
      "tag": "ss22-in",
      "listen": "0.0.0.0",
      "port": 8388,
      "protocol": "shadowsocks",
      "settings": {
        "method": "2022-blake3-aes-128-gcm",
        "password": "<base64 16-byte server key>",
        "clients": [
          { "password": "<base64 16-byte alice key>", "email": "alice" },
          { "password": "<base64 16-byte bob key>",   "email": "bob"   }
        ],
        "network": "tcp,udp"
      }
    }
  ]
}

SS-2022 outbound:

json
{
  "outbounds": [
    {
      "tag": "ss-out",
      "protocol": "shadowsocks",
      "settings": {
        "address": "example.com",
        "port": 8388,
        "method": "2022-blake3-aes-256-gcm",
        "password": "<base64 32-byte key>"
      }
    }
  ]
}

Notes ​

  • The cipher set comes from cipherFromString (infra/conf/shadowsocks.go:15-28) for the classic AEAD family and from Xray's own SS-2022 implementation for the 2022-blake3-... family; both match case-insensitively. Unknown ciphers fail to build.
  • There is no unencrypted method — none and plain are rejected as unknown ciphers.
  • SS-2022 passwords are raw key material, base64-encoded (a value that is not valid base64 is taken as raw bytes). 2022-blake3-aes-128-gcm uses 16-byte keys; 2022-blake3-aes-256-gcm and 2022-blake3-chacha20-poly1305 use 32-byte keys. A key of the wrong length fails when the inbound or outbound starts (bad key).
  • The runtime prints a deprecation banner ("Shadowsocks (with no Forward Secrecy, etc.)") at load time — infra/conf/shadowsocks.go:50, 200.

Cross-core notes ​

  • sing-box uses users[] for SS-2022 multi-user and adds a destinations[] array for the server-side relay form (one SS-2022 server fanning out to multiple upstream addresses). It also supports external plugins (plugin, plugin_opts) and offers UDP-over-TCP (udp_over_tcp) on the outbound, which Xray's Shadowsocks lacks. See Shadowsocks — sing-box.
  • mihomo uses the field name cipher (not method), takes plugin options as a generic plugin-opts map keyed by the plugin name, and supports a rich set of obfuscation plugins (obfs, v2ray-plugin, shadow-tls, restls, jls, kcptun). See Shadowsocks — mihomo.

Source: infra/conf/shadowsocks.go:30-197 · v26.11.9 (676eaf6)

Core Tutorial by Argsment