Skip to content

shadowsocks ​

Shadowsocks with AEAD ciphers and Shadowsocks 2022 (SIP022) ciphers, TCP and UDP. Compatible with sing-box, Xray and shadowsocks-rust shadowsocks for the same methods.

Methods ​

Familymethodpassword
AEADaes-128-gcm, aes-256-gcm, chacha20-ietf-poly1305, xchacha20-ietf-poly1305any string
20222022-blake3-aes-128-gcma 16-byte key in base64
20222022-blake3-aes-256-gcm, 2022-blake3-chacha20-poly1305a 32-byte key in base64

A 2022 key can be made with ours generate rand 16 --base64 (use 32 for a 32-byte key). Stream ciphers (rc4-md5, aes-*-ctr, aes-*-cfb, chacha20-ietf), none and aes-192-gcm (which sing-box has) are not supported.

Inbound ​

FieldTypeDefaultMeaning
methodstringrequiredThe encryption method
passwordstringrequiredThe password; for multi-user 2022, the server key (iPSK)
userslist of {name, password}—Multi-user mode: 2022 methods only, password is the user's key
networktcp, udp or a listbothWhat to accept

Socket settings are the listener block. Salt replay protection covers the whole process. The mux block enables accepting sing-mux. The inbound always understands UDP over TCP connections. There are no tls and transport blocks.

Not supported: destinations (relay), managed — not implemented yet.

Outbound ​

FieldTypeDefaultMeaning
serverhost:portrequiredThe server address
methodstringrequiredThe method
passwordstringrequiredThe password/key; for a user of multi-user 2022, server_key:user_key
networktcp, udp or a listbothWhat to pass
plugin{<name>: <options>}—A SIP003 plugin, see below
udp_over_tcpblock—UDP inside the TCP connection, see udp_over_tcp

Blocks: dial, mux. UDP goes to the server as separate UDP packets, with udp_over_tcp inside TCP.

Plugins ​

As in sing-box, the plugins are built in: no external process is started. The plugin's name is the key, its options are a SIP003 string (key=value separated by ;, \ escapes).

PluginOptionsWhat it does
obfs-local (simple-obfs)obfs=http (default) or tls; obfs-host=<name>http: the first data is the body of a WebSocket upgrade request; tls: in the session ticket of a ClientHello, then TLS records
v2ray-pluginhost (cloudfront.com by default), path (/), tls, cert=<path>, certRaw=<PEM without the frame>, mux=0WebSocket, with tls over TLS (the SNI is host); the stream goes in one mux.cool session unless mux=0

v2ray-plugin in mode=quic and other plugins are an error. The plugin carries only TCP; UDP goes to the same server address without it.

yaml
outbounds:
  ss-obfs:
    shadowsocks:
      server: ss.example.com:8388
      method: aes-256-gcm
      password: secret
      plugin:
        obfs-local: obfs=tls;obfs-host=www.bing.com

Example: a multi-user 2022 server ​

yaml
inbounds:
  ss-in:
    shadowsocks:
      listen: ":8388"
      method: 2022-blake3-aes-128-gcm
      password: dPbOJ32Gm1iOmcGttUzeBQ==
      users:
        - name: alice
          password: qy/172bxofI6z6QyNVcOxQ==
outbounds:
  ss-out:
    shadowsocks:
      server: ss.example.com:8388
      method: 2022-blake3-aes-128-gcm
      password: dPbOJ32Gm1iOmcGttUzeBQ==:qy/172bxofI6z6QyNVcOxQ==
route:
  final:
    outbound: ss-out

A minimal client:

yaml
outbounds:
  ss:
    shadowsocks:
      server: ss.example.com:8388
      method: chacha20-ietf-poly1305
      password: secret
route:
  final:
    outbound: ss

The keys in the examples are for demonstration.

Module description for developers: modules/shadowsocks.

GPL-3.0-or-later