English
subscriptions — subscriptions
A subscription is a list of servers from a provider: by URL or from a file. Each server becomes an outbound named <subscription>/<server>, and all servers of the subscription are collected into a group named after the subscription.
yaml
outbounds:
direct:
direct:
subscriptions:
work:
remote:
url: https://panel.example.com/sub/abc
update: 6h
headers:
User-Agent: my-router/1.0
exclude: '(?i)russia|🇷🇺'
group:
rank:
delay:
probe:
interval: 5m
groups:
main:
members: [work, direct]
route:
final:
group: mainHere work is a group of all the subscription's servers with a choice by delay; main is a manual choice between it and the direct outbound.
The content formats and what is taken from them are in Subscription formats.
Fields
| Field | Meaning |
|---|---|
remote | An http:// or https:// URL as a string, or a download block (below). Exactly one of remote and file |
file | A file on disk; reread when it changes |
group | A group of the subscription's servers, see below |
import_groups | Which of the provider's groups to take, see below |
rename | Renaming servers |
include, exclude | Filters by name |
protocols | Keep only servers of these protocols: [vless, hysteria2] |
patch | Changes applied to each server |
Download fields exist only in remote and are written inside its block; next to remote or file they are the error `update` belongs inside the `remote` block:
Field of the remote block | Meaning |
|---|---|
url | An http:// or https:// URL; required |
update | How often to download again; 1h by default |
via | The outbound or group to download through; without it, directly |
headers | Request headers: a mapping "name → value" |
hwid | What to send in the X-HWID header, see below |
Request: User-Agent and X-HWID
Without User-Agent in headers, ours/<version> is sent. Many panels choose the answer format by User-Agent; if a panel serves a format that cannot be read here, set the User-Agent of a client for which it serves links, Xray JSON or Clash YAML.
hwid is the device identifier by which providers count devices:
| Value | What goes into X-HWID |
|---|---|
auto (default) | A constant value for this machine and this subscription: a hash of /etc/machine-id (or the MAC of the first network card) and the URL |
random | A new random value on every download |
none | The header is not sent |
| another string | The value itself |
If X-HWID is in headers, that is what is sent, and a hwid field next to it is an error.
Server names: rename, include, exclude
yaml
subscriptions:
work:
file: servers.txt
rename:
- pattern: '^DE-(.*)$'
to: 'Germany-$1'
- pattern: '\s*\[.*\]'
to: ''
include: '(?i)germany|netherlands'
exclude: '(?i)test'
protocols: [trojan, vless]renameis a list of{pattern, to}replacements "regular expression → string", applied in order to the whole name;$1,${1},${name}are available into.includeandexcludeare regular expressions on the name afterrename, matching anywhere.- Regular expressions have no backreferences and no lookaround. An error in an expression is a load error.
- An empty name is replaced with the server's
host:port, a repeat withname-1,name-2; the characters* ? [ ] { }with_.
Changing servers: patch
Outbound blocks that are merged with each server field by field; the value from patch wins, and null removes a field or block:
yaml
subscriptions:
work:
remote: https://panel.example.com/sub/abc
patch:
dial:
connect_timeout: 5s
tls:
utls:
fingerprint: firefox
mux: nulldialis added to every server;muxto servers of thevless,trojan,shadowsocksprotocols.tls,transportand the protocol block change only for servers that already have them: a patch does not enable TLS on a server without it.- A
transportandmuxof another kind are replaced whole. - The order of layers:
outbounds.defaults< the server <patch.
Groups
The subscription's group: group
By default a group named after the subscription is created, with all its servers as members (match: "work/*") and rank: manual. group takes the group fields except members. group: false means no group is created.
The provider's groups: import_groups
Clash proxy-groups and Xray balancers become groups <subscription>/<name>:
| Value | Which groups are taken |
|---|---|
auto (default) | All except those that contain all the subscription's servers |
all | All |
none | None |
As a block: import_groups: {take: all, as: {rank: {delay: {}}}} — take as above, as group fields that replace the way of choosing set by the provider.
References to servers and groups
- A subscription server cannot be a direct target:
to: {outbound: work/de-1},final,dial.detourandvianaming it are errors. Put it in a group (members: [work/de-1]) and target the group. In themembersof groups and in theoutboundcondition of DNS rules the servers are available, by name or by the patternwork/*. - A name or pattern that currently selects nothing gives a warning, not an error.
- A provider's group can be referenced from a rule:
to: {group: work/Auto}. If the provider removed it, the name stays a group of one member, the target ofroute.final(iffinalis an outbound or a group), otherwise an empty group that refuses connections. A warning is written about it.
Updates
- At startup the servers are taken from the file or from the
cache(if enabled), without the network; thenremoteis downloaded. - If the set of servers changed, the configuration is rebuilt as on reload, with the
reloadpolicy. A failed download keeps the previous servers; the retry is aftermin(update, 5m). - Repeated downloads are conditional (ETag, Last-Modified). The cache keeps the content, the URL and
subscription-userinfo; when the URL changes the cache is not used. - A server that fails the check as an outbound (after
patch) is skipped with the reason, together with the servers that connect through it.
To see what the subscriptions contain: ours check --fetch (Command line). In the dashboard the subscriptions are visible in the Overview, with the update button there too.