Skip to content

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: 1m

A 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 ​

FieldMeaning
membersThe members: required
rankWho chooses and how; manual by default
interrupt_exist_connectionstrue closes the connections opened through the previous member when the choice changes. By default they live out on their own
reloadThe 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}}).

rankWho chooses
manualA person: in the dashboard or through the Admin API. No probes
orderThe first in members order that answers the probes
delayWhoever answered the last probe fastest
stableWhoever answered fastest and most evenly over the latest probes

manual ​

FieldMeaning
defaultThe member chosen before the first manual choice; without it, the first in members

A manual choice is kept:

  • across reloads, if the group's default did not change and the chosen member stayed in members;
  • across restarts, if cache is 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.

FieldMeaningDefault
pickHow many of the best members get connections: a number or all1
spreadHow to divide connections between the members taken (with pick above 1)hash
probeProbe settings, see below

stable also has:

FieldMeaningDefault
samplesHow many of the latest probes to take into account10
max_failuresWhat share of these probes, in percent (0–100), a member may fail and still be chosen20

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 recovery probes in a row, the members that answered the last probe, in members order;
    • while nothing is chosen, probes repeat every 5 seconds (or more often, if interval says so).
  • delay and stable take the first pick members 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 ​

ValueHow connections are divided
hashOne 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-robinIn turn
randomAt random
stickyA 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 ​

FieldMeaningDefault
urlWhat to request through the memberhttps://www.gstatic.com/generate_204
intervalHow often3m
idle_timeoutProbes stop if there were no connections through the group for longer than this; cannot be less than interval30m
toleranceHow many milliseconds faster a member outside the choice must be to displace the chosen one; has no effect for order50
recoveryHow many probes in a row a member must pass after a failure to be chosen again, while there is another working member3 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: 1m

Balancing across all members that answer, without ranking, is order with pick: all.

GPL-3.0-or-later