Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions docs/en/guide/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ The panel touches three keys of the root and leaves the rest as you wrote it, wi
| Key | What the panel does |
|:--|:--|
| `proxies` | Puts the person's servers **first**, before the proxies you wrote. A missing key (or `null`) is created. |
| `proxy-groups` | Adds the group `Auto` at the end while **Automatic server choice** is on and the template has no group of that name, even for a person with one server, so that your groups can refer to it. It is a `url-test` over the person's servers (not over your own `proxies`). |
| `proxy-groups` | Expands groups that opt in to panel order (see below). Also adds `Auto` at the end while **Automatic server choice** is on and the template has no group of that name, even for a person with one server, so your groups can refer to it. It is a `url-test` over the person's servers (not over your own `proxies`). |
| `dns` | Only when the template has none: the resolvers of the person's DNS preset, with `respect-rules: true`. Nothing else of the preset is added (see below). |

Everything else is yours: `rules`, `rule-providers`, `proxy-providers`, `tun`, the ports. The rules of the person's DNS preset (blocked ads, the split, countries) are **not** added to a template, because the order of the rules and the `MATCH` are yours; write them in the template if you need them. When the template has its own `dns`, the person's DNS preset and their pick on the page do not apply to the Mihomo apps (the other apps keep them).
Expand All @@ -332,12 +332,19 @@ The panel names the person's servers by the [server name template](#names-texts)

### Getting the servers into your groups

Do not write a server's name in a group: the servers differ from person to person, and a name a person does not have makes Mihomo refuse the whole file. The save refuses it too. Ask Mihomo for the servers instead:
Do not write a person's server name in a group: the servers differ from person to person, and a name a person does not have makes Mihomo refuse the whole file. The save refuses it too. You can refer to `Auto` for speed-based selection over the person's servers when the panel adds that group.

- `include-all-proxies: true` takes the person's servers and the proxies of your template;
- `filter` and `exclude-filter` (regular expressions) narrow them by name, for example `filter: "Germany"`;
- `include-all: true` also takes the groups of your `proxy-providers`;
- the group `Auto` is the person's servers by speed.
To use panel order, set `mistgate-ordered-proxies: true` on each proxy group you want to change. New templates start with this flag in their `Proxy` group. When rendering a subscription or preview, Mistgate keeps the entries already listed in the group's `proxies`, then appends the person's matching servers in panel order, then matching proxies declared in the template in declaration order, without adding names already present. Mistgate leaves the flag in the saved template but removes it from the rendered YAML. If no members match and the group has neither explicit members nor providers, the panel uses `empty-fallback`, or `COMPATIBLE` if it is not set.

Saved templates are not migrated. Without the opt-in, `include-all-proxies` and `include-all` keep their native Mihomo behavior, which sorts the automatically included local proxies by name. To switch an existing group:

- Replace `include-all-proxies: true` with `mistgate-ordered-proxies: true`. Keep any existing `include-all-providers` or `use` as written.
- Replace `include-all: true` with `mistgate-ordered-proxies: true` and `include-all-providers: true` to keep all providers. To use only selected providers in a specific order instead, leave `include-all-providers` off and list them in `use`. When all providers are enabled, Mihomo ignores `use`.
- Remove or set to `false` both native local inclusion flags, including any inherited through `<<`: the panel rejects either one set to `true` alongside the opt-in. Check the preview, save, then refresh the subscription in the app.

With the opt-in, the panel applies `filter` to the final names of the proxies it adds, not to the members you listed explicitly. Providers stay dynamic in Mihomo; the panel leaves `filter`, `exclude-filter` and `exclude-type` in the output. Use `filter: "Germany"` to match by name, not by IP or actual location. With providers and multiple backtick-separated expressions, Mihomo collects matches in expression order across all sources, including explicit members: `Auto` may no longer be first in a `select` group. A client's display sort by name or latency can differ from the order the core uses, including for `fallback`.

**Before downgrading:** Replace the new flag with `include-all-proxies: true` in groups that rely on it. An older panel does not expand the flag, so a group can be left without members and Mihomo can reject the profile.

A template for the group `ROUTER`, written with made-up names:

Expand All @@ -351,11 +358,11 @@ mode: rule
proxy-groups:
- name: Proxy
type: select
include-all-proxies: true
mistgate-ordered-proxies: true
proxies: [Auto, DIRECT] # Auto is the group the panel adds
- name: Germany
type: url-test
include-all-proxies: true
mistgate-ordered-proxies: true
filter: "Germany"
url: https://www.gstatic.com/generate_204
interval: 300
Expand All @@ -376,21 +383,25 @@ rules:
- MATCH,Proxy
```

A person in `ROUTER` gets this text with their servers at the top of `proxies`, `Auto` at the end of `proxy-groups` and a `dns` section, and nothing else changed.
A person in `ROUTER` gets their servers at the top of `proxies`, expanded `Proxy` and `Germany` member lists, `Auto` at the end of `proxy-groups`, and a `dns` section.

### What a save checks

The limits: 20 templates, 64 KiB each and 256 KiB in all; a name of 1 to 60 characters (the same name in another letter case counts as the same); at most 100 groups in one template; a group in one template only. A group you delete drops out of its template at the next save.

The save refuses a template, with the line in the message, when:
The save refuses a template when:

- the text is not valid UTF-8 or YAML, holds a second document (`---`), a key given twice, or aliases that expand far beyond the text;
- the root is not a mapping or has `<<`, or `proxies` or `proxy-groups` is not a plain list (an alias there would let the panel change the anchor too);
- a proxy has no `name`, a group has no `name` or `type`, names repeat, or one is a core name;
- a group refers in its `proxies` to a name that is no proxy or group of the template, no core name and not `Auto` (while the panel adds that group), or in `use` to a provider you did not define;
- the panel cannot build a profile from it with two sample servers.
- `mistgate-ordered-proxies` is not a YAML boolean, or a group enables it alongside `include-all-proxies` or `include-all` or shares its name with a proxy provider;
- an opted-in group has an invalid `filter` regular expression or matching exceeds the time limit;
- the panel cannot build a profile from it with three sample servers, one with a long name.

If matching runs out of time, the preview reports an error and the subscription refresh fails instead of sending the built-in profile. On Cloudflare Workers the clock does not advance during matching, so the Worker's CPU limit is the backstop.

Other findings do not stop a save and show in the preview as **Worth a look**: no group takes the person's servers (add `include-all-proxies` or refer to `Auto`); the template has its own `dns`; the person's DNS preset has ad, split or country rules that the template does not get; the template has its own `Auto`, so the panel adds none; a rule sends to a name that is nothing in the template; no group is chosen. The panel does not check the rest of Mihomo's keys: run the file in Mihomo for that.
Other findings do not stop a save and show in the preview as **Worth a look**: no group takes the person's servers (add `mistgate-ordered-proxies: true` or refer to `Auto`); the template has its own `dns`; the person's DNS preset has ad, split or country rules that the template does not get; the template has its own `Auto`, so the panel adds none; a rule sends to a name that is nothing in the template; no group is chosen. The panel does not check the rest of Mihomo's keys: run the file in Mihomo for that.

### Preview

Expand Down
Loading
Loading