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":
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
method | string | (required) | aes-128-gcm | aes-256-gcm | chacha20-poly1305 | xchacha20-poly1305 | 2022-blake3-aes-128-gcm | 2022-blake3-aes-256-gcm | 2022-blake3-chacha20-poly1305 | Cipher (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. |
password | string | (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). |
level | byte | 0 | <byte> | Policy level of the single-user account; users in clients carry their own level. |
email | string | (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 | *NetworkList | tcp | tcp | udp | tcp,udp | Comma-separated list (or single value) of supported transports. |
Source: infra/conf/shadowsocks.go:39-47 · pinned at v26.11.9 (676eaf6)
clients[]
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
method | string | (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. |
password | string | (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. |
level | byte | 0 | <byte> | Policy level for this user. |
email | string | (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. |
port | uint16 | (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 ownmethodandpassword; the top-levelpasswordis then ignored. - SS-2022:
clients[]entries carry user keys and an emptymethod, under the top-level servermethod/password; only the2022-blake3-aes-*-gcmciphers allow it. If the first entry has anaddress, the inbound becomes a relay: every entry then needsaddress/port, and itspasswordis the key of that destination server. - Clients of a multi-user SS-2022 server set
passwordto<server key>:<user key>.
Outbound
settings for an outbound of "protocol": "shadowsocks":
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
address | *Address | (unset) | <host> | Simplified shape — server hostname or IP. |
port | uint16 | (required with address) | <port> | Server port. |
level | byte | 0 | <byte> | User level. |
email | string | (unset) | <string> | User identifier. |
method | string | (required) | <see inbound methods> | Cipher used to talk to the server. |
password | string | (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[]
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
address | *Address | (required) | <host> | Server hostname or IP. |
port | uint16 | (required) | <port> | Server port. |
level | byte | 0 | <byte> | User level. |
email | string | (unset) | <string> | User identifier. |
method | string | (required) | <cipher> | Cipher. |
password | string | (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:
{
"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:
{
"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:
{
"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 the2022-blake3-...family; both match case-insensitively. Unknown ciphers fail to build. - There is no unencrypted method —
noneandplainare 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-gcmuses 16-byte keys;2022-blake3-aes-256-gcmand2022-blake3-chacha20-poly1305use 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 adestinations[]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(notmethod), takes plugin options as a genericplugin-optsmap 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)
