English
groups — groups of outbounds
A group hands a connection to one or several of its members. There are no kinds of groups: a group is a list of members members and a way of choosing rank. A group has no protocol blocks, tls, dial or mux of its own.
yaml
groups:
main:
members: [auto, proxy-de, proxy-nl, direct]
rank:
manual:
default: auto
auto:
members:
- match: "proxy-*"
rank:
delay:
probe:
interval: 1mA group is referred to like an outbound, but with the kind group: to: {group: main}, final: {group: main}. In members, dial.detour and via just the name is written.
Fields
| Field | Meaning |
|---|---|
members | The members: required |
rank | Who chooses and how; manual by default |
interrupt_exist_connections | true closes the connections opened through the previous member when the choice changes. By default they live out on their own |
reload | The reload policy for connections through the group — reload |
Members: members
A list of names of outbounds and groups mixed with match: <pattern> elements, or a single match::
yaml
groups:
europe:
members:
- proxy-de
- match: "proxy-{nl,fr}*"
- direct
everything:
members:
match: "proxy-*"- The order is as written; the matches of a pattern go in the order the names are defined. Repeats are dropped, and the group itself does not get into its own pattern.
- Patterns are globs (
*,?,[…],{a,b}), see Name patterns. A pattern that matched nothing is an error. - A group cannot include itself, neither directly nor through other groups:
group `a` contains itself: a -> b -> a. - An empty list is an error. The exception is a group whose members come from subscriptions (
match: "work/*"): the subscription may have no servers right now. Then loading gives a warning, and the empty group refuses new connections until the next update.
Way of choosing: rank
rank is written as a word (rank: delay) or as a block with settings (rank: {delay: {pick: 2}}).
rank | Who chooses |
|---|---|
manual | A person: in the dashboard or through the Admin API. No probes |
order | The first in members order that answers the probes |
delay | Whoever answered the last probe fastest |
stable | Whoever answered fastest and most evenly over the latest probes |
manual
| Field | Meaning |
|---|---|
default | The member chosen before the first manual choice; without it, the first in members |
A manual choice is kept:
- across reloads, if the group's
defaultdid not change and the chosen member stayed inmembers; - across restarts, if
cacheis enabled: the choice is stored by group name.
A default that is not in members is a startup error. The exception is a default pointing to a subscription server that disappeared on update: then the first member is chosen and a warning is given.
order, delay, stable
These ways choose by themselves, by probe results; a member cannot be chosen by hand in them.
| Field | Meaning | Default |
|---|---|---|
pick | How many of the best members get connections: a number or all | 1 |
spread | How to divide connections between the members taken (with pick above 1) | hash |
probe | Probe settings, see below |
stable also has:
| Field | Meaning | Default |
|---|---|---|
samples | How many of the latest probes to take into account | 10 |
max_failures | What share of these probes, in percent (0–100), a member may fail and still be chosen | 20 |
stable ranks by the sum of the mean response time and its standard deviation.
How the ways behave when nobody answers:
order:- before the first probe and while nothing is chosen, the first member that supports the connection's network (TCP or UDP);
- if no member has passed
recoveryprobes in a row, the members that answered the last probe, inmembersorder; - while nothing is chosen, probes repeat every 5 seconds (or more often, if
intervalsays so).
delayandstabletake the firstpickmembers before the first probe, and if nobody answered, the first member that supports the connection's network (TCP or UDP).
The choice is made separately for TCP and UDP: a member that cannot do UDP gets no UDP connections.
spread
| Value | How connections are divided |
|---|---|
hash | One site always goes to one member. A site is the last two levels of the domain, or the address. When the set of members changes, only the sites of the member that left move |
round-robin | In turn |
random | At random |
sticky | A client (source address) on one site keeps to one member for ttl, then the choice is made again. Written as a block: spread: {sticky: {ttl: 10m}}; ttl is 10m by default |
probe
| Field | Meaning | Default |
|---|---|---|
url | What to request through the member | https://www.gstatic.com/generate_204 |
interval | How often | 3m |
idle_timeout | Probes stop if there were no connections through the group for longer than this; cannot be less than interval | 30m |
tolerance | How many milliseconds faster a member outside the choice must be to displace the chosen one; has no effect for order | 50 |
recovery | How many probes in a row a member must pass after a failure to be chosen again, while there is another working member | 3 for order, 1 for delay and stable |
A probe is a HEAD request to url through the member with a 15-second timeout; no more than ten members of a group are checked at the same time. A probe can be started by hand from the dashboard.
Example: load balancing
Connections are divided between the three fastest servers, and a client keeps to its server on a site for 10 minutes:
yaml
groups:
balanced:
members:
match: "proxy-*"
rank:
stable:
pick: 3
spread:
sticky:
ttl: 10m
probe:
url: https://cp.cloudflare.com/
interval: 1mBalancing across all members that answer, without ranking, is order with pick: all.