Happ routing profiles
Routing profiles for the Happ client that reproduce the behaviour of the FlipVPN admin tab «Списки без VPN» (bypass of blocks and allow lists) with the production route lists.
What is here
| Path | What |
|---|---|
geo/geoip.dat |
GeoIP file with the production codes R4, R6, B4, W4
|
geo/geosite.dat |
GeoSite file with the production codes WD, RD, RDRU, BD
|
profile-bypass.json |
Profile «Обход блокировок» |
profile-whitelist.json |
Profile «Белые списки» |
link-bypass.txt |
happ://routing/onadd/… deeplink for the bypass profile |
link-whitelist.txt |
happ://routing/add/… deeplink for the allow-list profile |
link-*-urlsafe.txt |
The same deeplinks in base64url, for clients that need it |
geo/sing-box/ |
Compiled sing-box rule sets for BD, RDRU, R4, R6, B4 and SHA256SUMS
|
geo/SHA256SUMS |
Checksums of the full geoip.dat and geosite.dat
|
geo/slim/ |
Slim geoip.dat and geosite.dat for the router (only R4, R6, B4, BD, RDRU) |
keenetic/install-proxy.sh |
The Keenetic installer: sing-box, rule sets, hysteria 2, TPROXY |
keenetic/README.md |
The Russian instruction for the Keenetic setup |
build/ |
The scripts that produced the files |
The deeplink payload is standard base64 with padding, the form the official generator
(Happ-proxy/routing_generator) and the vendor documentation produce.
The Happ client decodes the routing payload with the standard base64 alphabet only: a url-safe
payload is rejected with «Неправильные данные для импортирования профиля маршрутизации»
(parsing_error_invalid_routing). Standard base64 may contain + and /, so the generator
picks the JSON layout whose payload contains neither of them, which keeps the deeplink safe in a
link, a query string, a header and a clipboard.
The codes
| Code | List | Meaning |
|---|---|---|
R4, R6
|
route lists | Russian IPv4 and IPv6 subnets, sent directly |
B4 |
blocked addresses | Blocked addresses, sent through the tunnel |
RD |
Russian service domains | Kept in the file, not used by the profiles: the FlipVPN client sends them directly only when the address is in R4 (RD ∧ R4), Happ cannot join a domain and an address in one rule, and geoip:R4 already covers that case |
RDRU |
Russian service domains, .ru/.su/.рф names without the blocked domains |
Domains sent directly by name (DirectSites of the bypass profile) |
BD |
blocked domains | Domains sent through the tunnel |
WD, W4
|
allow lists | Domains and addresses sent directly |
The codes are uppercase: the xray core uppercases the code of the rule and looks the entry up by prefix, so a lowercase code is not found and the whole config fails to load.
How to set it up in Happ
The routing profile and the VLESS account are separate imports:
- Import the account (the
vless://link or the subscription) the usual way. - Open
link-bypass.txt(orlink-whitelist.txt) on the phone, or paste it into Happ: thehapp://routing/…link adds the routing profile. The bypass link usesonaddand switches the profile on at once; the whitelist link usesaddand only adds it.
No panel and no subscription carries the profile.
When the lists change, only the geo/ files are replaced in this repository. Happ downloads them
again from Geoipurl / Geositeurl when the profile is imported again with a newer LastUpdated,
so a new link is needed only when the profile itself (its rules or its URLs) changes.
Addresses the files need
The Geoipurl and Geositeurl inside the profiles point at the geo/ files of this repository.
The phone downloads them, so the raw addresses must answer without a login.
The Keenetic router
keenetic/install-proxy.sh puts a proxy engine on a Keenetic router from a share link: a
hysteria2:// link installs sing-box with the compiled .srs rule sets (or Xray with
--engine xray), a vless:// link (Reality, tcp, xtls-rprx-vision) installs Xray with the slim
geo/slim/*.dat databases. TCP is
redirected through nat/REDIRECT, UDP through mangle/TPROXY; IPv6 is not intercepted and can
be switched off with keenetic-proxy --disable-ipv6. Two modes are available: bypass
(default — BD/B4 through the tunnel, RDRU/R4/R6 and the private ranges direct, everything
else through the tunnel) and blocked (only BD/B4 through the tunnel, everything else direct).
The mode is switched without reinstalling.
The step-by-step instruction is keenetic/README.md (Russian).
Rebuilding
The files are built from the production route lists: either the public routes snapshot the
clients download (no credentials; it holds only the live rows) or a dump of the RouteListEntry rows
with d = 0 of the production database:
curl -sS -o routes.zlib https://storage.yandexcloud.net/configurations/routes
python3 -I -c 'import json,sys,zlib; s=json.loads(zlib.decompress(open(sys.argv[1],"rb").read())); sys.stdout.write("".join("%s\t%s\n" % p for p in sorted((r["l"], r["v"]) for r in s["l"])))' routes.zlib > db_fresh.tsv
mariadb -h 127.0.0.1 -P 39920 -u database_service -p'…' vpn -N -B \
-e "SELECT l, v FROM RouteListEntry WHERE d=0 ORDER BY l, v;" > db_fresh.tsv
python3 build/happ-routing-profile.py --rows db_fresh.tsv --out-dir . \
--base-geoip geoip_base.dat --base-geosite geosite_base.dat \
--geoip-url <URL-geoip> --geosite-url <URL-geosite>
python3 build/happ-routing-dat-check.py --rows db_fresh.tsv \
--geoip geo/geoip.dat --geosite geo/geosite.dat
python3 build/happ-routing-srs.py --geoip geo/geoip.dat --geosite geo/geosite.dat \
--out-dir geo/sing-box --sing-box /path/to/sing-box
The build stops with unknown list codes in the dump when the lists gain a code the script does not
know: add the code to ROW_CODE_TO_UPPER and decide its profile rule from the FlipVPN client first.
--profile name=path re-links an existing profile with new URLs without rebuilding the geo files.
The geo files keep the Loyalsoldier base sections next to the production codes, so geosite:cn and
the like keep working when the profile is edited inside the app.