How I adapted v2rayN for Russia or Russian sources of geo files for v2ray/sing-box/etc

Today the major release v2rayN v7.0 was released, and with it my series of commits that add support for the “Russia” preset.

Introduction

It's no secret that due to blocking of “regular” VPN protocols in Russia, many users have switched to using v2ray/xray/sing-box. As you know, almost all GUI clients are developed in China for China, but their specifics are of little use for Russia (at least for now).

Therefore, I came up with the idea of ​​​​making a repository with Russian GeoIP/GeoSite files, as well as adding their support to probably the most popular client for Windows – v2rayN.

Please note that since version 7.0.0 v2rayN supports Linux!

v2rayN

If you are not interested in the details, here is a link to the release: v2rayN v7.0

You just need to download v2rayN-windows-64-SelfContained-With-Core.7zunpack and run v2rayN.exe.

After that add your config and click Настройки -> Региональные пресеты -> Россия (For English locale Settings -> Regional presets setting -> Russia).

What has been done

  1. Added support for third-party sources of GeoIP/GeoSite files for Xray and sing-box and their updates.

  2. Added support for third-party sources of routing rules.

  3. Added support for third party DNS configuration sources for Xray and sing-box.

  4. In fact, the “Russia” preset has been added, which simply sets all the above parameters and updates Geo files.

v2rayN has already added support for Russian sources, but you can use your own. All sources except DNS are configured in Настройки -> Настройки параметров -> Настройка v2rayN.

Downloading from all sources occurs through a proxy, so you don’t have to worry about future blocks.

GeoIP/GeoSite sources

Official GeoIP/GeoSite and sing-box srs files are downloaded from the repository @runetfreedom/russia-v2ray-rules-dat

This repository is an aggregator of files from @runetfreedom/russia-blocked-geoip And @runetfreedom/russia-blocked-geosite. The only purpose of this aggregation is that the v2rayN code expects one repository for both file types.

Read more about the contents of these files below.

Sources of routing rules

Official routing rules are downloaded from the repository @runetfreedom/russia-v2ray-custom-routing-list

All rules block advertising and pass traffic directly to private and reserved networks defined in RFC6890.

There are currently 3 sets of rules:

  1. Everything – as the name suggests, it directs all traffic to a proxy/VPN.

  2. Everything except Russia – all traffic is sent to the proxy/VPN, except for torrents and all Russian IPs. In this mode, government services, Russian Railways, banks, etc. operate normally.

  3. Blocked – Only domains blocked in Russia (antifilter community and re:filter) and IP addresses are sent to the proxy/VPN. Additionally, we had to turn off UDP ports 50000-65535 for Discord voice to work.

The choice of rule depends on the task and the desired level of anonymity, but in general, for the average user, the second set is sufficient. Because of the new locking approach at TSPU, we don't actually have a single registry of the resources they apply restrictions to, so the third set may not work perfectly.

DNS configuration sources

Official DNS configuration is downloaded from the repository @runetfreedom/russia-v2ray-custom-routing-list

There is nothing particularly interesting about them, they are very similar to the built-in ones except for blocking ads and replacing Chinese DNS for local queries with Yandex DNS (77.88.8.8)

Russian source of GeoIP and GeoSite files

I didn’t find a single repository on the Internet that would collect all the sources together, so I decided to make my own.

Sources of data on blocking in Russia are:

  1. antifilter.download

  2. community.antifilter.download

  3. re:filter

For routers and mobile phones it is worth using geosite-ru-only.dat And geoip-ru-only.datsince full lists are too large for them.

Content is updated every 6 hours using GitHub Actions.

GeoIP

GeoIP files are available in the repository @runetfreedom/russia-blocked-geoip

The following output formats are currently supported:

  • geoip.dat (V2Ray, Xray-core, v2rayN and others)

  • MaxMind mmdb

  • sing-box srs

  • mihomo mrs

  • Clash rules

  • SURGE rules

  • nginx allow and deny templates (for reverse proxy and fallback schemes)

Main categories:

  1. geoip:ru-blocked contains ipresolve.lst And subnet.lst antifilter.download service

  2. geoip:ru-blocked-community contains community.lst service community.antifilter.download

  3. geoip:re-filter contains ipsum.lst from re:filter

For your convenience, several additional ASN-based categories are included in the files:

  • geoip:cloudflare

  • geoip:cloudfront

  • geoip:facebook

  • geoip:fastly

  • geoip:google

  • geoip:netflix

  • geoip:telegram

  • geoip:twitter

  • geoip:ddos-guard

  • geoip:yandex

File contents:

  • geoip.dat, Country.mmdb – contains a complete set of data (original geoip + all categories)

  • geoip-asn.dat, Country-asn.mmdb – contains only additional categories

  • geoip-ru-only.dat, Country-ru-only.mmdb – contains only lists of blocked networks and addresses + private (geoip:ru-blocked, geoip:ru-blocked-community, geoip:re-filter And geoip:private)

  • ru-blocked.dat, ru-blocked-community.dat, re-filter.dat – separately corresponding categories (geoip.dat format only)

  • private.dat – Private/Reserved networks (RFC6890)

Directory contents

In all directories, the contents are divided according to the principle “1 file = 1 category”

  • datgeoip.dat format

  • text – Text lists

  • srs – sing-box format

  • clash – Clash format (including classic and ip-cidr notation)

  • mrs – mihomo format

  • surge – SURGE format

  • nginx – allow and deny rules for nginx

GeoSite

GeoSite files are available in the repository @runetfreedom/russia-blocked-geosite

Currently only the format is supported geosite.dat

In addition to blocked lists, the following are used:

Additional domains from @runetfreedom/russia-domains-list. To add blocked domains, if possible, instead of PR to this repository, please use the Antifilter Community bot

Available categories

  • All categories from @v2fly/domain-list-community. Including: google, discord, youtube, twitter, meta, openai and so on.

  • geosite:ru-blocked – domains blocked in Russia (antifilter-download-community + re:filter)

  • geosite:ru-blocked-allall known domains blocked in Russia (antifilter-download + antifilter-download-community + re:filter). The list contains at least 700 thousand domains, use with caution.

  • geosite:ru-available-only-inside – Domains available only within Russia

  • geosite:antifilter-download – all domains from antifilter.download (almost 700 thousand, use with caution)

  • geosite:antifilter-download-community – all domains from community.antifilter.download

  • geosite:refilter – all domains from re:filter

  • geosite:category-ads-all – all advertising domains

  • geosite:win-spy – domains used by Windows for tracking and collecting analytics

  • geosite:win-update – domains used by windows for updates

  • geosite:win-extra – other domains used by windows

note that geosite:category-ads-all from v2fly is overwritten because it is too small and largely useless.

The release also contains these categories in the form of text files with a list of domains.

Conclusion

All files are available for download and use for any purpose. If you have ideas or suggestions, please write to the issues of the corresponding repositories.

I also planned to create routing rules for FoxRay (client for iOS/macOS), but the client developers recently removed support for importing rules.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *