Skip to content

mihomo — Config Layout

mihomo reads a single YAML document at startup. The root document maps to Go struct RawConfig at config/config.go:392. Unlike Xray and sing-box, there is no top-level log block — most operational toggles are flat keys at the document root, with a small number of nested blocks for feature areas (dns, tun, profile, …).

Flat top-level keys

These are scalar fields at the document root.

KeyGo fieldTypePageDescription
portPortintBasicsHTTP proxy port.
socks-portSocksPortintBasicsSOCKS proxy port.
redir-portRedirPortintBasicsLinux REDIRECT inbound port.
tproxy-portTProxyPortintBasicsLinux TPROXY inbound port.
mixed-portMixedPortintBasicsHTTP + SOCKS multiplexed port.
ss-configShadowSocksConfigstringPhase 3Shadowsocks inbound URI.
vmess-configVmessConfigstringPhase 3VMess inbound URI.
inbound-tfoInboundTfoboolBasicsTCP Fast Open for inbounds.
inbound-mptcpInboundMPTCPboolBasicsMultipath TCP for inbounds.
authenticationAuthentication[]stringBasicsuser:pass list for HTTP/SOCKS auth.
skip-auth-prefixesSkipAuthPrefixes[]netip.PrefixBasicsSource CIDRs that skip authentication.
lan-allowed-ipsLanAllowedIPs[]netip.PrefixBasicsAllow list when allow-lan is true.
lan-disallowed-ipsLanDisAllowedIPs[]netip.PrefixBasicsDeny list when allow-lan is true.
allow-lanAllowLanboolBasicsBind listeners on 0.0.0.0/:: instead of localhost.
bind-addressBindAddressstringBasicsOverride the bind address (with allow-lan).
modeModeT.TunnelModeBasicsrule / global / direct.
unified-delayUnifiedDelayboolBasicsCancel proxy URL-test handshake bias.
log-levelLogLevellog.LogLevelLogdebug / info / warning / error / silent.
ipv6IPv6boolBasicsEnable IPv6 throughout the stack.
external-controllerExternalControllerstringExternal ControllerRESTful API listen address.
external-controller-pipeExternalControllerPipestringExternal ControllerWindows named-pipe path for API.
external-controller-unixExternalControllerUnixstringExternal ControllerUnix-socket path for API.
external-controller-tlsExternalControllerTLSstringExternal ControllerTLS-listen address.
external-controller-corsExternalControllerCorsRawCorsExternal ControllerCORS allow-list.
external-uiExternalUIstringExternal ControllerStatic-asset directory for the dashboard.
external-ui-urlExternalUIURLstringExternal ControllerAuto-download URL for the dashboard tarball.
external-ui-nameExternalUINamestringExternal ControllerSubdirectory under external-ui.
external-doh-serverExternalDohServerstringExternal ControllerDoH server endpoint hosted by mihomo.
secretSecretstringExternal ControllerBearer-token for the API.
interface-nameInterfacestringBasicsOutbound interface binding.
routing-markRoutingMarkintBasicsLinux SO_MARK for outbound sockets.
tunnelsTunnels[]LC.TunnelPhase 6Static port-to-target tunnels.
geo-auto-updateGeoAutoUpdateboolGeo DataAuto-refresh geoip/geosite assets.
geo-update-intervalGeoUpdateIntervalintGeo DataAuto-refresh interval (hours).
geodata-modeGeodataModeboolGeo DataUse geoip.dat instead of Country.mmdb.
geodata-loaderGeodataLoaderstringGeo DataLoader choice (memconservative vs standard).
geosite-matcherGeositeMatcherstringGeo DataMatcher implementation.
tcp-concurrentTCPConcurrentboolBasicsRace A/AAAA dials.
find-process-modeFindProcessModeprocess.FindProcessModeBasicsstrict / always / off.
global-client-fingerprintGlobalClientFingerprintstringBasicsDefault uTLS fingerprint for outbounds.
global-uaGlobalUAstringBasicsDefault HTTP User-Agent.
etag-supportETagSupportboolBasicsHonor ETag on subscription fetches.
keep-alive-idleKeepAliveIdleintBasicsTCP keepalive idle (seconds).
keep-alive-intervalKeepAliveIntervalintBasicsTCP keepalive interval (seconds).
disable-keep-aliveDisableKeepAliveboolBasicsDisable TCP keepalive.

Nested blocks and lists

KeyGo fieldTypePageDescription
proxy-providersProxyProvidermap[string]map[string]anyPhase 6Remote proxy lists.
rule-providersRuleProvidermap[string]map[string]anyPhase 5Remote rule sets.
proxiesProxy[]map[string]anyPhase 3Outbound proxy definitions.
proxy-groupsProxyGroup[]map[string]anyPhase 5Group selectors / url-test / fallback / load-balance / relay.
rulesRule[]stringPhase 5Routing rules (compact string form).
sub-rulesSubRulesmap[string][]stringPhase 5Named sub-rule groups.
listenersListeners[]map[string]anyPhase 3Free-form inbound listeners.
hostsHostsmap[string]anyPhase 5Static DNS overrides.
dnsDNSRawDNSPhase 5DNS subsystem block.
ntpNTPRawNTPNTPEmbedded NTP client.
tunTunRawTunPhase 6TUN inbound.
tuic-serverTuicServerRawTuicServerPhase 3TUIC inbound.
iptablesIPTablesRawIPTablesiptablesLinux iptables auto-configuration.
experimentalExperimentalRawExperimentalExperimentalFingerprints, QUIC tuning, IPv4-in-IPv6 conversion.
profileProfileRawProfileProfilePersisted state (selected proxy, fake-ip cache).
geox-urlGeoXUrlRawGeoXUrlGeo DataDownload URLs for the four geo asset files.
snifferSnifferRawSnifferSnifferConnection sniffing (TLS SNI, HTTP Host, QUIC).
tlsTLSRawTLSTLSDefault TLS material for inbounds.
clash-for-androidClashForAndroidRawClashForAndroidClash for AndroidAndroid-app-specific settings.

At a glance

yaml
mode: rule
mixed-port: 7890
allow-lan: false
log-level: info
external-controller: 127.0.0.1:9090

dns:
  enable: true
  nameserver:
    - https://1.1.1.1/dns-query

proxies: []
proxy-groups: []
rules: []

Source: config/config.go:392-459 · v1.19.24 (a847246)

Core Tutorial by Argsment