Auto routing

RCX is the ReClash server-selection engine: smart groups pick their own server by profile, and a scenario steers the whole connection.

On this page

Model

RCX works on the select groups of the running config. Selection never changes a group's members: the engine picks one as a manual tap would, and records why. Only scenario routes add groups and rules, at config apply.

ObjectWhat it isWhere it comes from
Smart groupA select group whose member the engine chooses.A binding from the subscription, the user or the running scenario.
ProfileHow one group chooses (the app calls it a behaviour): pool, tiers, ranking, switching, checks, network kinds.Built in, provider, or user.
ScenarioWhole-connection behavior: group programs, routes, tunnel mode per network kind.Same three sources; one per subscription.
RouteRules placed before the config's rules; matched traffic goes to its own group, an existing target, or DIRECT.The running scenario, at config apply.
EvidencePer-server latency samples, failures, check results and exit country.Probes, URL tests and real traffic.
80%
Diagram source
mermaid
flowchart LR
    Profile --> Policy
    Binding[Provider and user bindings] --> Policy
    Program[Scenario program] --> Policy
    Policy --> Decide{{Decide}}
    Evidence --> Decide
    Decide --> Ranking[Ranking and reason]
    Ranking --> Member[Selected member]
    Member -. probes and traffic .-> Evidence

A group's policy is its profile plus the bindings and scenario program. The decision is a pure function of policy, evidence and context; its explanation is the ranking it decided on. See Engine.

Profile and scenario

ProfileScenario
ScopeOne groupThe connection
ChoosesA server among the group's membersProfile, pool, order or fixed member per named group; tunnel mode
Network kindson.<kind> changes the profile's tiers, rank, switching, pool, stranded and energyon.<kind> replaces group programs and the mode
Adds rulesNoYes, via routes (rule mode only)
ReferenceProfilesScenarios

A group the running scenario does not name keeps its binding. With no binding and no program, it is a plain selector.

Identifiers

Profiles and scenarios have separate namespaces, keyed as <source>/<name>.

SourcePrefixEditable
Built inbuiltin/No; edits go to a copy.
Subscription providerprovider/No; edits go to a copy. A bare fast means provider/fast.
Useruser/Yes. Profiles are shared by all subscriptions; the user layer (bindings, scenario, allowed hosts) belongs to one subscription.

Built-in profiles and scenarios

IdLevelBehavior
builtin/simplesimpleOne tier not dead; latency rank, tolerance 50; improve: false, feel calm. Default for groups without a usable profile.
builtin/fastestsimpleLatency rank, tolerance 20; improve: true, feel balanced.
builtin/stablesimpleStability rank, tolerance 100; improve: true, feel calm.
builtin/from-listsimpleextends: builtin/simple; for hand-picked servers, which get pinned.
builtin/bypass-ruadvancedTiers: passes open (https://api.telegram.org/) with a non-RU exit; any non-RU exit; any working server last. Kinds portal (paused) and open; direct split on home fail and foreign ok.
builtin/bypass-ir, builtin/bypass-cnadvancedSame tiers for IR and CN, checked on youtube.com and google.com generate_204; kind portal only.
builtin/whitelist-ruadvancedExtends bypass-ru; adds tag bypass and kind whitelist (home ok and foreign fail); bypass servers first.
builtin/every-group (scenario)—groups: {'*': {}}: every select group except GLOBAL becomes smart with its binding's profile. The app runs it when auto routing is turned on and no scenario was chosen.
builtin/whitelist-ru (scenario)—$main runs bypass-ru without bypass servers; on kind whitelist the mode becomes global and GLOBAL runs simple over bypass servers.

Glossary

TermMeaning
BindingAttaches a profile to a group: profile, default, pool, prefer, feel, energy, chips. See Bindings.
ProgramScenario action on one group: profile, pool, prefer or to.
PoolMembers a group may choose from, after include and exclude.
TierOne prefer entry: a label and a condition; the app calls it a step of the Server order.
FallbackThe last-resort step (last-resort): used only when no other step has a working server.
ToleranceRanking bonus in milliseconds for the current server, against flapping.
StrandedNo eligible member; stranded says what to do.
Network kindNamed network class (portal, whitelist, …) recognized by network conditions.
DiagnosticDirect device probe, outside the tunnel, that recognizes network kinds.
CheckRequest through a server to see whether it opens something (passes(id)).
Exit countryCountry a server's traffic leaves from, agreed by independent sources.
Direct splitRouting DIRECT-matched connections through a smart group while direct access is broken.
ControlAuto, pinned or manual, per group.
JournalThe last 200 engine events: switches, failures, control, network, mode and direct-split changes.

Minimal example

nearest.rcx.yaml
rcx: 1
title: Nearest working
prefer:
  - { label: Fast, when: 'latency < 150ms' }
  - { label: Any, when: 'not dead' }
rank: { by: latency, tolerance: 30 }
switch: { improve: true, feel: balanced }

The group takes a server under 150 ms if one is measured, else any working server, and switches to a faster one only past the balanced thresholds. Import it in the app or serve it from a subscription; see Sharing.

Searches every section: providers and RCX