Routing profiles
A routing profile decides which traffic goes through the proxy, which goes direct and which is blocked, and which DNS servers are used. The format is the Happ routing profile JSON. A subscription can ship one, and a user can add one from a link, from a QR code or by hand in Routing.
Format
Section titled “Format”A profile is a JSON object. Only Name is required.
| Key | Type | Effect |
|---|---|---|
Name |
non-empty string | Profile name. |
GlobalProxy |
bool (or the strings "true"/"false") |
true: all traffic goes through the proxy and the lists below are not used. Local networks and DNS are still handled first. |
DirectSites |
string or array of strings | Domains that go direct. |
DirectIp |
string or array of strings | IPs and CIDRs that go direct. |
ProxySites |
string or array of strings | Domains that go through the proxy. |
ProxyIp |
string or array of strings | IPs and CIDRs that go through the proxy. |
BlockSites |
string or array of strings | Domains that are blocked. |
BlockIp |
string or array of strings | IPs and CIDRs that are blocked. |
DomainStrategy |
AsIs, IPIfNonMatch, IPOnDemand (any case) |
Xray domain strategy. Default AsIs. |
RemoteDNSType |
DoH or DoU |
DNS for traffic that goes through the proxy: DNS over HTTPS or plain UDP. |
RemoteDNSDomain |
string | DoH: the resolver as a URL (https://1.1.1.1/dns-query) or a host name (https:// and /dns-query are added). DoU: the resolver’s host name, used as udp://<host> when there is no IP. Together with https:// it must form a valid host. |
RemoteDNSIP |
string | The resolver’s IP. For DoH it is also the address used to reach the resolver’s host name without a lookup. For DoU it is the server address. |
DomesticDNSType |
DoH or DoU |
DNS for direct traffic. |
DomesticDNSDomain |
string | As RemoteDNSDomain. |
DomesticDNSIP |
string | As RemoteDNSIP. |
DnsHosts |
object | Static host names: { "example.com": "203.0.113.5" }. |
FakeDNS |
bool (or "true"/"false") |
Validated and stored, but not applied: the client always passes the user’s own FakeDNS setting (Settings → Advanced, off by default), and that setting decides. |
Geoipurl |
string | https:// URL of the geoip.dat file. |
Geositeurl |
string | https:// URL of the geosite.dat file. |
LastUpdated |
number or string | Time the profile (and its geo files) changed: Unix seconds or milliseconds, an ISO 8601 date, or the same number as text. A value newer than the last geo download triggers a re-download. |
Rules about values:
- A list given as a string is split at commas and line breaks. Entries use Xray routing syntax:
geosite:category-ru,geoip:ru,geoip:private,domain:example.com,full:www.example.com,keyword:ads,regexp:..., CIDR such as10.0.0.0/8. - A key with a value of the wrong type rejects the whole profile (“Expected string”, “Expected boolean”, “DNS type must be DoH or DoU”, “Invalid domain strategy”, “Invalid DNS endpoint”, “DnsHosts must be an object”, “Expected string or list of strings”). Booleans may be written as strings.
- An unknown key is ignored with a warning (“Unknown routing profile key”). Key names are case-sensitive.
- JSON comments and trailing commas are accepted.
What the profile becomes
Section titled “What the profile becomes”Rules are evaluated top to bottom; the first match wins.
- DNS traffic goes to the built-in DNS handler.
- If the user keeps Bypass local networks on, private addresses (
geoip:private) go direct. - The user’s Excluded routes go direct.
- Queries of the domestic resolver go direct; queries of the remote resolver go through the proxy.
- In Rules mode and when
GlobalProxyis nottrue:BlockSites,BlockIp,DirectSites,DirectIp,ProxySites,ProxyIp, in that order. - Everything else: the proxy (or the direct route in Direct mode).
The user’s routing mode is chosen separately: Rules uses the profile, All traffic sends everything through the proxy and Direct sends everything direct; the profile’s lists are not used in the last two.
DNS: the remote resolver serves proxied traffic. The domestic resolver serves the domains in DirectSites and expects answers inside DirectIp, so those names resolve locally. With nothing configured the client uses https://1.1.1.1/dns-query.
Geo files
Section titled “Geo files”geosite: and geoip: entries need geo data files in the v2ray format.
- mins downloads
Geoipurlasgeoip.datandGeositeurlasgeosite.dat. The URLs must be HTTPS; up to 5 redirects are followed and each must be HTTPS too. - If a file
<url>.sha256sumexists, its leading 64-hex digest must match the download; on a mismatch the download is refused and the previous file is kept. - A file is downloaded when it is missing, when the last download is 7 days old or more, or when the profile’s
LastUpdatedis newer than the last download. The file is validated before it replaces the old one. - If your rules use
geoip:orgeosite:but the profile has no URLs, mins downloads therunetfreedom/russia-v2ray-rules-datfiles. - The user can also manage the files by hand under Routing → Geo data.
Built-in templates
Section titled “Built-in templates”The Routing screen offers three templates, saved as ordinary profiles. They show a complete profile:
| Template | GlobalProxy |
DirectSites |
DirectIp |
Geo files |
|---|---|---|---|---|
| Global | true |
none | geoip:private |
Loyalsoldier/v2ray-rules-dat |
| Russia | false |
geosite:category-ru |
geoip:private, geoip:ru |
runetfreedom/russia-v2ray-rules-dat |
| China | false |
geosite:cn |
geoip:private, geoip:cn |
Loyalsoldier/v2ray-rules-dat |
All three share these values: BlockSites: ["geosite:category-ads-all"], ProxySites, ProxyIp and BlockIp empty, RemoteDNSType: "DoH", RemoteDNSDomain: "https://1.1.1.1/dns-query", RemoteDNSIP: "1.1.1.1", DomesticDNSType: "DoH", DomesticDNSDomain: "https://dns.google/dns-query", DomesticDNSIP: "8.8.8.8", DomainStrategy: "IPIfNonMatch", FakeDNS: false.
Example
Section titled “Example”{ "Name": "Russia", "GlobalProxy": false, "DirectSites": ["geosite:category-ru"], "DirectIp": ["geoip:private", "geoip:ru"], "BlockSites": ["geosite:category-ads-all"], "ProxySites": [], "ProxyIp": [], "BlockIp": [], "RemoteDNSType": "DoH", "RemoteDNSDomain": "https://1.1.1.1/dns-query", "RemoteDNSIP": "1.1.1.1", "DomesticDNSType": "DoH", "DomesticDNSDomain": "https://dns.google/dns-query", "DomesticDNSIP": "8.8.8.8", "DomainStrategy": "IPIfNonMatch", "FakeDNS": false, "Geositeurl": "https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat", "Geoipurl": "https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat", "LastUpdated": "1798761600"}Delivering a profile with a subscription
Section titled “Delivering a profile with a subscription”| How | Details |
|---|---|
routing response header (or #routing: line) |
The value is the profile as one-line JSON, base64 of the JSON (optionally with a base64: prefix), an https:// URL of the JSON, or a mins://, happ:// or incy:// routing link. See Response headers. |
| A routing link on its own line in the body | Same links as in Links and deep links. |
How the client treats a subscription’s profile:
- It is saved as an inactive profile, listed in Routing with the source From subscription, and replaced on every subscription update that carries an inline profile. A profile given only as a URL is downloaded when the subscription is imported and is not downloaded again by subscription updates.
- It is used by that subscription’s servers only after
routing-enableis accepted by the user (aroutingheader with a profile sets it totruefor you).routing-enable: falsestops those servers from using a routing profile at all. See Approval. - Servers delivered as a full Xray JSON do not use the subscription’s profile; they keep their own
routingsection.
Profiles delivered by mins://routing/add|onadd/... links and QR codes are separate from subscriptions: they are saved as imported profiles, active only for onadd.