Skip to content

Snell — mihomo ​

Snell is Surge's lightweight proxy protocol. mihomo implements both a Snell outbound (to connect to a Snell server) and a Snell inbound listener (to act as one). Both sides support the simple-obfs obfuscation layer with http or tls modes (except on Snell v6, which replaces it with PSK-derived traffic shaping); the outbound's obfs-opts.mode additionally accepts the shadow-tls, restls, and jls TLS-camouflage layers, whose inbound counterparts are the dedicated shadow-tls / res-tls / jls-config listener blocks.

Outbound ​

Entry under proxies: with type: snell. Embeds BasicOption (common outbound fields).

FieldTypeDefaultAllowed valuesDescription
namestring(required)<string>Unique proxy name.
serverstring(required)<host>Upstream server hostname or IP.
portint(required)<port>Upstream server port.
pskstring(required)<string>Pre-shared key (password). Version 6 requires 12 to 255 bytes.
udpboolfalsetrue | falseEnable UDP relaying (Snell v3 or newer).
versionint11 | 2 | 3 | 4 | 5 | 6Snell protocol version. v5 servers are backward-compatible with v4 clients, so mihomo dials them as v4.
reuseboolfalsetrue | falseReuse underlying connections (v4, v5 and v6; always on for v2).
modestringdefaultdefault | unshaped | unsafe-rawVersion 6 only; must match the server. default encrypts and shapes traffic with a PSK-derived record and padding profile; unshaped keeps the encryption but drops the shaping; unsafe-raw sends records without encryption. Setting it with any other version fails at startup.
obfs-optsmap[string]any(disabled){ mode, ... }Obfuscation options. mode selects http / tls (simple-obfs, with host; not available on version 6), or shadow-tls / restls / jls; the remaining keys follow the matching Shadowsocks plugin schema.
client-fingerprintstring(global)chrome | firefox | safari | ios | edge | random | randomizeduTLS client-hello fingerprint used by the shadow-tls / restls / jls obfs modes.

Source: adapter/outbound/snell.go:33-45 · pinned at v1.19.34 (0455d0d)

Inbound ​

Entry under listeners: with type: snell. Embeds BaseOption (listen, port).

FieldTypeDefaultAllowed valuesDescription
pskstring(required)<string>Pre-shared key (password). Version 6 requires 12 to 255 bytes.
versionint41 | 2 | 3 | 4 | 5 | 6Snell protocol version.
modestringdefaultdefault | unshaped | unsafe-rawVersion 6 only; clients must use the same mode. Same values as the outbound's mode. Setting it with any other version fails at startup.
udpbooltruetrue | falseAccept UDP relayed inside the TCP stream (clients need Snell v3 or newer).
obfs-optsSnellObfsOption(disabled)SnellObfsOptionsimple-obfs options ({ mode, host }). Not available on version 6 — startup fails.
shadow-tlsShadowTLS(disabled)ShadowTLSServer-side Shadow-TLS camouflage block ({ enable, version, password, users, handshake, ... }).
res-tlsResTLS(disabled)ResTLSServer-side Restls camouflage block ({ enable, dest, password, ... }); unauthenticated clients are relayed to dest.
jls-configJLSConfig(disabled)JLSConfigServer-side JLS camouflage block ({ enable, users, sni, dest, ... }); unauthenticated clients are relayed to dest.

Source: listener/inbound/snell.go:13-23 · pinned at v1.19.34 (0455d0d)

obfs-opts ​

FieldTypeDefaultAllowed valuesDescription
modestring(unset)http | tlsObfuscation mode.
hoststring(unset)<host>Obfuscation host header.

Source: listener/inbound/snell.go:29-32 · pinned at v1.19.34 (0455d0d)

Examples ​

Outbound — plain Snell:

yaml
proxies:
  - name: snell-srv
    type: snell
    server: example.com
    port: 44046
    psk: <pre-shared-key>
    version: 3
    udp: true

Outbound — Snell with HTTP obfuscation:

yaml
proxies:
  - name: snell-obfs
    type: snell
    server: example.com
    port: 44046
    psk: <pre-shared-key>
    version: 3
    obfs-opts:
      mode: http
      host: bing.com

Outbound — Snell v6:

yaml
proxies:
  - name: snell-v6
    type: snell
    server: example.com
    port: 44046
    psk: <pre-shared-key>
    version: 6
    mode: default
    udp: true
    reuse: true

Inbound under listeners:

yaml
listeners:
  - name: snell-in
    type: snell
    listen: 0.0.0.0
    port: 44046
    psk: <pre-shared-key>
    version: 3
    udp: true
    obfs-opts:
      mode: tls
      host: bing.com

Notes ​

  • psk is the shared secret; the outbound and inbound must use the same value.
  • UDP relaying requires Snell v3 or newer — the outbound rejects udp: true with version 1 or 2.
  • reuse (outbound only) reuses the underlying connection. It is implied for Snell v2; for v4, v5 and v6 it is opt-in via this field (v1 and v3 never reuse).
  • obfs-opts.mode selects the obfuscation layer: http wraps the stream in a fake HTTP request, tls in a fake TLS record (the host sets the obfuscation host header), and shadow-tls / restls / jls run the corresponding TLS-camouflage handshake — the remaining obfs-opts keys then follow the same schema as the matching Shadowsocks plugin-opts block (see Shadowsocks). Leave obfs-opts unset for no obfuscation. Both sides must agree on the mode and its settings.
  • The outbound's client-fingerprint only matters for the shadow-tls / restls / jls obfs modes, where it picks the uTLS client-hello mimicked during the camouflage handshake.
  • The inbound accepts only http / tls in obfs-opts; its TLS-camouflage layers are configured through the dedicated shadow-tls / res-tls / jls-config blocks instead, which are mutually exclusive.
  • Snell v6 replaces simple-obfs with PSK-derived traffic shaping: obfs-opts with http / tls fails at startup on version 6 (the outbound's shadow-tls / restls / jls modes and the inbound's camouflage blocks still work). Both sides need a PSK of 12–255 bytes and the same mode. unsafe-raw drops the encryption entirely — only use it where the path is already protected.

Cross-core notes ​

  • Snell originated in Surge. Xray-core does not support it. sing-box implements Snell inbounds and outbounds (type: "snell"; outbound version 4 or 6, inbound 5 or 6 — Snell v5's QUIC proxy mode is intentionally not implemented), with snake_case fields such as psk, obfs_mode and obfs_host, the same v6 mode values, and multi-user inbounds (users), which mihomo's Snell inbound does not offer. See Snell — sing-box.

Source: adapter/outbound/snell.go:33-45 · v1.19.34 (0455d0d)

Core Tutorial by Argsment