Skip to content

AnyTLS — mihomo

mihomo speaks AnyTLS on both sides, with the standard mihomo conventions (cipher-free; outbound carries TLS / ECH / uTLS knobs at the top level).

Outbound

Entry under proxies: with type: anytls. Embeds BasicOption.

FieldTypeDefaultAllowed valuesDescription
namestring(required)<string>Unique proxy name.
serverstring(required)<host>Upstream server hostname or IP.
portint(required)<port>Upstream server port.
passwordstring(required)<string>Server password.
alpn[]string[]h2 | http/1.1ALPN list offered during the TLS handshake.
snistring(server)<SNI>TLS Server Name Indication.
ech-optsECHOptions(disabled)ECHOptionsEncrypted Client Hello configuration.
client-fingerprintstring(global)chrome | firefox | safari | ios | edge | random | randomizeduTLS client-hello fingerprint.
skip-cert-verifyboolfalsetrue | falseDisable TLS verification (test only).
fingerprintstring(unset)<SHA256 hex>Pin the server's TLS certificate fingerprint.
certificatestring(unset)<PEM file path>Client certificate (mTLS).
private-keystring(unset)<key file path>Private key for `certificate`.
udpboolfalsetrue | falseAllow UDP packets to be relayed through this outbound.
idle-session-check-intervalint0<seconds>Session-pool scan interval. 0 keeps the runtime default.
idle-session-timeoutint0<seconds>Sessions idle longer than this many seconds are recycled. 0 keeps the runtime default.
min-idle-sessionint0<int>Minimum warm sessions to keep in the pool.

Source: adapter/outbound/anytls.go:25-43 · pinned at v1.19.27 (5184081)

Inbound

Entry under listeners: with type: anytls. Embeds BaseOption.

FieldTypeDefaultAllowed valuesDescription
usersmap[string]string{}{<username>: <password>}User table — username → password.
certificatestring(required)<PEM file path>TLS server certificate.
private-keystring(required)<key file path>TLS private key.
client-auth-typestring(none)no-client-cert | request-client-cert | require-any-client-cert | verify-client-cert-if-given | require-and-verify-client-certMutual-TLS client-auth mode.
client-auth-certstring(unset)<PEM file path>CA bundle accepted as client roots.
ech-keystring(unset)<ECH config>Encrypted Client Hello material.
allow-insecureboolfalsetrue | falseSkip TLS client-certificate verification on the listener (testing only).
padding-schemestring(server default)<scheme>Custom padding scheme. Single string; the upstream protocol-spec format.

Source: listener/inbound/anytls.go:12-22 · pinned at v1.19.27 (5184081)

Examples

Outbound:

yaml
proxies:
  - name: anytls
    type: anytls
    server: example.com
    port: 443
    password: <password>
    sni: example.com
    alpn: [h2, http/1.1]
    udp: true
    client-fingerprint: chrome
    idle-session-check-interval: 30
    idle-session-timeout: 60
    min-idle-session: 4

Inbound:

yaml
listeners:
  - name: anytls-in
    type: anytls
    listen: 0.0.0.0
    port: 443
    users:
      alice: <alice-password>
      bob: <bob-password>
    certificate: /etc/mihomo/server.crt
    private-key: /etc/mihomo/server.key

Notes

  • mihomo uses seconds for the three session-pool timeouts; sing-box uses duration strings ("30s") for the same fields. The field-name spelling is also different — kebab-case here, snake_case there.
  • users: is a YAML map of username → password, mirroring mihomo's TUIC and Hysteria2 inbounds.
  • mihomo's outbound carries TLS, ECH, and uTLS-fingerprint knobs inline. sing-box places these in the embedded tls: block.

Cross-core notes

  • Xray-core does not support AnyTLS. See AnyTLS — Xray-core.
  • sing-box uses snake_case field names, takes Go-style duration strings for the session-pool timeouts, and lists users as a [{name, password}] array. See AnyTLS — sing-box.

Source: adapter/outbound/anytls.go:25-43 · v1.19.27 (5184081)

Core Tutorial by Argsment