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.
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
name | string | (required) | <string> | Unique group name. Referenced from rules and other groups. |
type | string | (required) | select | url-test | fallback | load-balance | Group 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. |
url | string | (required for url-test/fallback) | <URL> | Health-check URL — periodic GET on this URL measures member latency. Typical: http://www.gstatic.com/generate_204. |
interval | int | 300 | <seconds> | Seconds between health checks. |
timeout | int | 5000 | <milliseconds> | Health-check timeout in milliseconds. |
max-failed-times | int | 5 | <int> | Consecutive health-check failures before a member is considered down. |
empty-fallback | string | (unset) | <proxy name> | Proxy to fall back to when the group resolves to no usable members (e.g. everything was removed by filter). |
lazy | bool | true | true | false | When true, health checks only run when the group is actively in use. Saves bandwidth on standby groups. |
disable-udp | bool | false | true | false | Reject UDP traffic on this group. Useful when members don't all support UDP. |
filter | string | (unset) | <regex> | <regex>`<regex>... | Regex filter applied to member names. Multiple regexes can be backtick-separated. |
exclude-filter | string | (unset) | <regex> | Regex filter — exclude any member whose name matches. |
exclude-type | string | (unset) | <proxy type> | Exclude members of specific types (e.g. direct,ss). |
expected-status | string | * | <HTTP status range> | Acceptable health-check status codes. 2xx or 200-204,301. |
include-all | bool | false | true | false | Auto-include all proxies and providers — saves listing them manually. |
include-all-proxies | bool | false | true | false | Auto-include all proxy entries (but not providers). |
include-all-providers | bool | false | true | false | Auto-include all proxy-providers (but not direct proxies). |
hidden | bool | false | true | false | Hide the group from the dashboard UI. |
icon | string | (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.
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 byprofile.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).
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.
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:
| Strategy | Behavior |
|---|---|
round-robin | Rotate through members in order. |
consistent-hashing | Hash the destination domain — same domain always goes to the same member. Useful for sticky CDN routing. Default. |
sticky-sessions | The first connection for a source IP + destination domain pair picks a member; later connections for the same pair reuse it for 10 minutes. |
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.
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:
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: trueis shorthand for bothinclude-all-proxiesandinclude-all-providers: true.include-all-proxiescovers entries inproxies:.include-all-providerscovers entries pulled in viaproxy-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:
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,🚀 ProxyCross-core notes
sing-box equivalent — selector / urltest outbounds
sing-box implements the same idea as outbound types rather than a separate "group" concept:
{
"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:
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
outbounds | []string | (required) | [<outbound tag>] | Member outbounds. |
default | string | (first in outbounds) | <outbound tag> | Initial selection at startup. |
interrupt_exist_connections | bool | false | true | false | When 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:
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
outbounds | []string | (required) | [<outbound tag>] | Member outbounds. |
url | string | https://www.gstatic.com/generate_204 | <URL> | Health-check URL. |
interval | badoption.Duration | 3m | <duration> | How often to re-test members. |
tolerance | uint16 | 50 | <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_timeout | badoption.Duration | 30m | <duration> | Stop health-checking after this much idle time — resume on next demand. |
interrupt_exist_connections | bool | false | true | false | Close 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.
