Skip to content

Proxy groups — mihomo ​

Proxy groups are named bundles of proxies / other groups that act as a single named outbound. mihomo offers four group types: select (manual), url-test (latency-based auto), fallback (sequential health-based), and load-balance (distribute traffic).

Common options ​

Every group type carries the same GroupCommonOption base. The group:"..." struct tag is mihomo's own — the YAML keys match the tag.

FieldTypeDefaultAllowed valuesDescription
namestring(required)<string>Unique group name. Referenced from rules and other groups.
typestring(required)select | url-test | fallback | load-balanceGroup type. There is no relay type — use dialer-proxy on the proxy entry instead.
proxies[]string[][<proxy or group name>]Explicit list of members. Use use: for provider-based membership.
use[]string[][<proxy-provider name>]Pull members from named proxy-providers.
urlstring(required for url-test/fallback)<URL>Health-check URL — periodic GET on this URL measures member latency. Typical: http://www.gstatic.com/generate_204.
intervalint300<seconds>Seconds between health checks.
timeoutint5000<milliseconds>Health-check timeout in milliseconds.
max-failed-timesint5<int>Consecutive health-check failures before a member is considered down.
empty-fallbackstring(unset)<proxy name>Proxy to fall back to when the group resolves to no usable members (e.g. everything was removed by filter).
lazybooltruetrue | falseWhen true, health checks only run when the group is actively in use. Saves bandwidth on standby groups.
disable-udpboolfalsetrue | falseReject UDP traffic on this group. Useful when members don't all support UDP.
filterstring(unset)<regex> | <regex>`<regex>...Regex filter applied to member names. Multiple regexes can be backtick-separated.
exclude-filterstring(unset)<regex>Regex filter — exclude any member whose name matches.
exclude-typestring(unset)<proxy type>Exclude members of specific types (e.g. direct,ss).
expected-statusstring*<HTTP status range>Acceptable health-check status codes. 2xx or 200-204,301.
include-allboolfalsetrue | falseAuto-include all proxies and providers — saves listing them manually.
include-all-proxiesboolfalsetrue | falseAuto-include all proxy entries (but not providers).
include-all-providersboolfalsetrue | falseAuto-include all proxy-providers (but not direct proxies).
hiddenboolfalsetrue | falseHide the group from the dashboard UI.
iconstring(unset)<URL>Icon URL displayed by compatible dashboards.

Source: adapter/outboundgroup/parser.go:25-46 · pinned at v1.19.34 (0455d0d)

Each group type additionally decodes its own small option struct from the same YAML entry: SelectorOption, URLTestOption, FallbackOption (currently empty), and LoadBalanceOption. The type-specific keys are listed in each section below.

type: select ​

Manual selection. The group exposes its current pick to the Clash API (dashboards let users switch). No health-checking — the picked member is used as-is.

yaml
proxy-groups:
  - name: Manual
    type: select
    default-selected: Proxy-B
    proxies: [Proxy-A, Proxy-B, Proxy-C, DIRECT]

Extra option (SelectorOption, adapter/outboundgroup/selector.go:12-14):

  • default-selected (string) — member selected when the group is created, before any dashboard pick (or a selection restored from the cache by profile.store-selected) is applied. When unset or not found among the members, the first member is used.

type: url-test ​

Auto-pick the fastest member by periodic URL latency probe. The probe runs every interval seconds; the active pick changes only when a new member is faster by more than tolerance (decoded via URLTestOption at adapter/outboundgroup/urltest.go:17-19).

yaml
proxy-groups:
  - name: Auto
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    tolerance: 50
    proxies: [Proxy-JP, Proxy-US, Proxy-HK, Proxy-SG]

Extra option (URLTestOption, adapter/outboundgroup/urltest.go:17-19):

  • tolerance (uint16, milliseconds) — switch threshold. Defaults to 0 (always switch to the absolute fastest, which can thrash).

type: fallback ​

Use the first member that's responding. Members are health-checked in declaration order; the first one that's alive carries all traffic. Useful for "primary + backup" patterns. Its FallbackOption struct is currently empty — the type has no extra keys beyond the common set.

yaml
proxy-groups:
  - name: HA
    type: fallback
    url: http://www.gstatic.com/generate_204
    interval: 60
    timeout: 3000
    max-failed-times: 3
    proxies: [Primary, Backup, DIRECT]

type: load-balance ​

Distribute traffic across members. The strategy field (LoadBalanceOption, adapter/outboundgroup/loadbalance.go:22-25) picks the algorithm, defaulting to consistent-hashing:

StrategyBehavior
round-robinRotate through members in order.
consistent-hashingHash the destination domain — same domain always goes to the same member. Useful for sticky CDN routing. Default.
sticky-sessionsThe first connection for a source IP + destination domain pair picks a member; later connections for the same pair reuse it for 10 minutes.
yaml
proxy-groups:
  - name: Distributed
    type: load-balance
    url: http://www.gstatic.com/generate_204
    interval: 300
    strategy: consistent-hashing
    proxies: [Proxy-1, Proxy-2, Proxy-3]

hash-key (the second LoadBalanceOption key) changes what the hashing strategies hash, not how they pick a member. Its only value is in-user: the authenticated inbound user name — the same value IN-USER rules match — so all of one user's connections stay on one member (and one egress IP) even when they go to many different domains. Requests without an authenticated user keep the strategy's own key. It works with consistent-hashing, which keeps a user on the same member as long as the member list and the members' health don't change, and with sticky-sessions, which remembers the pick for 10 minutes. Combined with round-robin (which hashes nothing), or set to any other value, it makes the group fail at startup.

yaml
proxy-groups:
  - name: Per-user
    type: load-balance
    url: http://www.gstatic.com/generate_204
    interval: 300
    strategy: sticky-sessions
    hash-key: in-user
    proxies: [Proxy-1, Proxy-2, Proxy-3]

type: relay — not supported ​

mihomo has no chain-of-proxies group type: chain proxies with the per-proxy dialer-proxy: field instead (see Direct for an example). A config that declares type: relay fails with an explicit error at startup (adapter/outboundgroup/parser.go:216-217).

Member-set tools ​

When you have many proxies, manually listing them on every group is painful. The four include-all* flags + filter / exclude-filter solve this:

yaml
proxy-groups:
  - name: All-JP
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 300
    include-all: true
    filter: 'JP|Japan|🇯🇵'
    exclude-type: 'direct,reject'

The four flags ratchet up:

  • include-all: true is shorthand for both include-all-proxies and include-all-providers: true.
  • include-all-proxies covers entries in proxies:.
  • include-all-providers covers entries pulled in via proxy-providers:.
  • Plain use: references named providers explicitly.

filter accepts backtick-separated regexes — each is an OR. So filter: 'JP\Japan`🇯🇵'` matches any proxy whose name contains any of the three strings.

Examples ​

A typical multi-tier setup:

yaml
proxy-providers:
  vendor1:
    type: http
    url: https://example.com/sub
    interval: 86400
    path: ./providers/vendor1.yaml

proxy-groups:
  - name: 🚀 Proxy
    type: select
    proxies: [♻️ Auto, 🔯 Fallback, 🔮 LoadBalance, DIRECT]

  - name: ♻️ Auto
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 300
    tolerance: 50
    use: [vendor1]
    filter: '香港|新加坡|HK|SG'

  - name: 🔯 Fallback
    type: fallback
    url: http://www.gstatic.com/generate_204
    interval: 60
    use: [vendor1]
    filter: '日本|JP'

  - name: 🔮 LoadBalance
    type: load-balance
    url: http://www.gstatic.com/generate_204
    interval: 300
    strategy: consistent-hashing
    use: [vendor1]

  - name: 🎬 Stream
    type: select
    include-all: true
    filter: '美|US|🇺🇸'

rules:
  - DOMAIN-SUFFIX,netflix.com,🎬 Stream
  - MATCH,🚀 Proxy

Cross-core notes ​

sing-box equivalent — selector / urltest outbounds ​

sing-box implements the same idea as outbound types rather than a separate "group" concept:

json
{
  "outbounds": [
    { "type": "selector",
      "tag": "manual",
      "outbounds": ["proxy-jp", "proxy-us", "direct"],
      "default": "proxy-jp",
      "interrupt_exist_connections": false },
    { "type": "urltest",
      "tag": "auto",
      "outbounds": ["proxy-jp", "proxy-us"],
      "url": "https://www.gstatic.com/generate_204",
      "interval": "3m",
      "tolerance": 50 }
  ]
}

Selector:

FieldTypeDefaultAllowed valuesDescription
outbounds[]string(required)[<outbound tag>]Member outbounds.
defaultstring(first in outbounds)<outbound tag>Initial selection at startup.
interrupt_exist_connectionsboolfalsetrue | falseWhen the selection changes, close in-flight connections that used the previous member.

Source: option/group.go:5-9 · pinned at v1.14.4 (c005f35)

URLTest:

FieldTypeDefaultAllowed valuesDescription
outbounds[]string(required)[<outbound tag>]Member outbounds.
urlstringhttps://www.gstatic.com/generate_204<URL>Health-check URL.
intervalbadoption.Duration3m<duration>How often to re-test members.
toleranceuint1650<milliseconds>Switch to a new member only if it's faster by more than this many milliseconds. Prevents thrashing when two members have similar latency.
idle_timeoutbadoption.Duration30m<duration>Stop health-checking after this much idle time — resume on next demand.
interrupt_exist_connectionsboolfalsetrue | falseClose in-flight connections on switchover.

Source: option/group.go:11-18 · pinned at v1.14.4 (c005f35)

sing-box has no exact equivalent of mihomo's fallback or load-balance groups. The closest pattern is to use urltest with a very tight tolerance for fallback-style behavior, or chain selectors.

Xray equivalent — balancers ​

Xray's balancers are documented on the Routing page. Strategy values: random, roundRobin, leastPing, leastLoad. There is no Xray equivalent of "selector" (manual pick) — balancers auto-route based on strategy.

Core Tutorial by Argsment