Skip to content

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.

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 as 10.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.

Rules are evaluated top to bottom; the first match wins.

  1. DNS traffic goes to the built-in DNS handler.
  2. If the user keeps Bypass local networks on, private addresses (geoip:private) go direct.
  3. The user’s Excluded routes go direct.
  4. Queries of the domestic resolver go direct; queries of the remote resolver go through the proxy.
  5. In Rules mode and when GlobalProxy is not true: BlockSites, BlockIp, DirectSites, DirectIp, ProxySites, ProxyIp, in that order.
  6. 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.

geosite: and geoip: entries need geo data files in the v2ray format.

  • mins downloads Geoipurl as geoip.dat and Geositeurl as geosite.dat. The URLs must be HTTPS; up to 5 redirects are followed and each must be HTTPS too.
  • If a file <url>.sha256sum exists, 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 LastUpdated is newer than the last download. The file is validated before it replaces the old one.
  • If your rules use geoip: or geosite: but the profile has no URLs, mins downloads the runetfreedom/russia-v2ray-rules-dat files.
  • The user can also manage the files by hand under Routing → Geo data.

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.

{
"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"
}
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-enable is accepted by the user (a routing header with a profile sets it to true for you). routing-enable: false stops 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 routing section.

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.