Routing rules
Mole builds the Xray-core routing configuration on the client. This page describes what goes into it and in what order it applies.
Region presets
Mole uses the geosite and geoip lists built into Xray-core — there are no separate rule files to download.
| Preset | Rules |
|---|---|
| Russia | geosite:category-ru, geoip:ru → direct |
| China | geosite:cn, geoip:cn → direct |
| Iran | geosite:category-ir, geoip:ir → direct |
Presets are toggled independently on the Routing screen.
Custom rules
User-defined rules are configured on the Routing screen and support three actions:
- Direct: traffic bypasses the tunnel and goes out through the local ISP.
- Block: the connection is immediately dropped.
- Proxy: traffic is explicitly routed through the active proxy tunnel.
Supported Rule Syntax
Mole supports the complete range of Xray-core domain and IP matchers:
| Prefix / Type | Example | Behavior |
|---|---|---|
domain: |
domain:google.com or google.com |
Matches the specified domain and all of its subdomains |
full: |
full:api.telegram.org |
Strict exact match (subdomains are not captured) |
keyword: |
keyword:instagram |
Substring match anywhere in the hostname |
regexp: |
regexp:^.*\.internal\..*$ |
Regular expression pattern matching |
geosite: |
geosite:category-gov-ru |
Predefined categories from the bundled GeoSite database |
| IP Address | 192.168.1.50 |
Individual IPv4 or IPv6 address |
| CIDR Subnet | 10.200.0.0/16, 2001:db8::/32 |
IPv4 and IPv6 Classless Inter-Domain Routing ranges |
geoip: |
geoip:telegram, geoip:ru |
Country codes and service ranges from the bundled GeoIP database |
Order of evaluation
Rules are matched top to bottom; the first match wins:
- The server's own address → direct. This must come first, otherwise traffic to the server would re-enter the tunnel and the connection would deadlock.
- QUIC (UDP 443) → block, when Block QUIC is on (the default). Xray does not proxy QUIC under
flow: xtls-rprx-vision, so blocking it makes apps fall back to HTTPS over TCP. Turn it off to let HTTP/3 through on servers that do carry UDP — Hysteria2, or VLESS without Vision. - DNS (port 53, UDP and TCP) → the built-in resolver.
- Local network (
geoip:private,geosite:private) → direct, when LAN bypass is on. - Region presets → direct.
- Custom rules — Direct first, then Block.
- IPv6 (
::/0) → block, when that option is on. - Everything else → proxy.
Custom rules sit below the presets
User rules are evaluated after the region presets. If a preset is on and already covers a domain, your rule for that domain will not be reached.
domainStrategy is fixed at IPIfNonMatch: a domain is matched against the domain rules first and only resolved to an IP — for the IP rules — when nothing matched.
Full configurations
If a subscription serves a ready-made Xray config, none of the above applies: routing comes from the provider's config. See Full configurations.