### Complete V2Ray v4 Client Configuration Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt A comprehensive V2Ray client configuration including DNS, routing, and inbounds. Requires V2Ray version 4.37.2 or higher for skipFallback support. This example sets up SOCKS5 and HTTP proxies and handles BT traffic. ```jsonc { "log": { "loglevel": "warning" }, "dns": { "hosts": { "dns.google": "8.8.8.8", "dns.pub": "119.29.29.29", "dns.alidns.com": "223.5.5.5", "geosite:category-ads-all": "127.0.0.1" }, "servers": [ { "address": "https://1.1.1.1/dns-query", "domains": ["geosite:geolocation-!cn", "geosite:google@cn"], "expectIPs": ["geoip:!cn"] }, "8.8.8.8", { "address": "114.114.114.114", "port": 53, "domains": ["geosite:cn", "geosite:icloud", "geosite:category-games@cn"], "expectIPs": ["geoip:cn"], "skipFallback": true }, { "address": "localhost", "skipFallback": true } ] }, "inbounds": [ { "protocol": "socks", "listen": "0.0.0.0", "port": 1080, "tag": "Socks-In", "settings": { "ip": "127.0.0.1", "udp": true, "auth": "noauth" }, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } }, { "protocol": "http", "listen": "0.0.0.0", "port": 2080, "tag": "Http-In", "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } } ], "outbounds": [ { "protocol": "vmess", // replace with your protocol: socks/shadowsocks/vless/trojan "settings": {}, "tag": "Proxy", "streamSettings": {}, "mux": {} }, { "protocol": "dns", "tag": "Dns-Out" }, { "protocol": "freedom", "tag": "Direct", "settings": { "domainStrategy": "UseIPv4" } }, { "protocol": "blackhole", "tag": "Reject", "settings": { "response": { "type": "http" } } } ], "routing": { "domainStrategy": "IPIfNonMatch", "domainMatcher": "mph", "rules": [ { "type": "field", "outboundTag": "Direct", "protocol": ["bittorrent"] }, { "type": "field", "outboundTag": "Dns-Out", "inboundTag": ["Socks-In", "Http-In"], "network": "udp", "port": 53 }, { "type": "field", "outboundTag": "Reject", "domain": ["geosite:category-ads-all"] }, { "type": "field", "outboundTag": "Proxy", "domain": ["full:www.icloud.com", "domain:icloud-content.com", "geosite:google"] }, { "type": "field", "outboundTag": "Direct", "domain": ["geosite:tld-cn", "geosite:icloud", "geosite:category-games@cn"] }, { "type": "field", "outboundTag": "Proxy", "domain": ["geosite:geolocation-!cn"] }, { "type": "field", "outboundTag": "Direct", "domain": ["geosite:cn", "geosite:private"] }, { "type": "field", "outboundTag": "Direct", "ip": ["geoip:cn", "geoip:private"] }, { "type": "field", "outboundTag": "Proxy", "network": "tcp,udp" } ] } } ``` -------------------------------- ### Download geosite.dat (Binary GeoSite Database) Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Download the latest geosite.dat file from GitHub Releases. Verify its integrity using the provided SHA256 checksum. A CDN alternate download is also available. ```bash curl -L -o geosite.dat \ https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat ``` ```bash curl -L -o geosite.dat.sha256sum \ https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat.sha256sum ``` ```bash sha256sum -c geosite.dat.sha256sum ``` ```bash curl -L -o geosite.dat \ https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat ``` -------------------------------- ### Configure mihomo with CDN GeoIP/GeoSite Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Set up mihomo to fetch the latest geoip and geosite data directly from a CDN. Ensure the geodata-mode is enabled. ```yaml geodata-mode: true geox-url: geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" geosite: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat" rules: - GEOSITE,category-ads-all,REJECT - GEOSITE,apple-cn,DIRECT - GEOSITE,google-cn,DIRECT - GEOSITE,geolocation-!cn,Proxy - GEOSITE,cn,DIRECT - GEOIP,cn,DIRECT - GEOIP,private,DIRECT - MATCH,Proxy ``` -------------------------------- ### Download geoip.dat (Binary GeoIP Database) Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Download the latest geoip.dat file from GitHub Releases. Verify its integrity using the provided SHA256 checksum. Alternate downloads are available via CDN. ```bash curl -L -o geoip.dat \ https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat ``` ```bash curl -L -o geoip.dat.sha256sum \ https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat.sha256sum ``` ```bash sha256sum -c geoip.dat.sha256sum ``` ```bash curl -L -o geoip.dat \ https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat ``` ```bash curl -L -o geoip.dat \ https://fastly.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat ``` -------------------------------- ### Download Plain-Text Domain Lists Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Download various plain-text domain lists for use in DNS resolvers, firewalls, or custom tooling. These lists cover direct-connect, proxy, reject, and specific service domains. ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/china-list.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/apple-cn.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/google-cn.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-spy.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-update.txt ``` ```bash curl -L -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/win-extra.txt ``` -------------------------------- ### V2Ray v4 Client Configuration Source: https://github.com/loyalsoldier/v2ray-rules-dat/blob/master/README.md This is a comprehensive V2Ray client configuration for version 4.x. It requires V2Ray v4.37.2 or newer due to the 'skipFallback' DNS option. The configuration sets up SOCKS and HTTP proxies, handles DNS resolution with specific fallbacks, and defines routing rules for direct connections, proxying, and blocking. ```jsonc { "log": { "loglevel": "warning" }, "dns": { "hosts": { "dns.google": "8.8.8.8", "dns.pub": "119.29.29.29", "dns.alidns.com": "223.5.5.5", "geosite:category-ads-all": "127.0.0.1" }, "servers": [ { "address": "https://1.1.1.1/dns-query", "domains": ["geosite:geolocation-!cn", "geosite:google@cn"], "expectIPs": ["geoip:!cn"] }, "8.8.8.8", { "address": "114.114.114.114", "port": 53, "domains": [ "geosite:cn", "geosite:icloud", "geosite:category-games@cn" ], "expectIPs": ["geoip:cn"], "skipFallback": true }, { "address": "localhost", "skipFallback": true } ] }, "inbounds": [ { "protocol": "socks", "listen": "0.0.0.0", "port": 1080, "tag": "Socks-In", "settings": { "ip": "127.0.0.1", "udp": true, "auth": "noauth" }, "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } }, { "protocol": "http", "listen": "0.0.0.0", "port": 2080, "tag": "Http-In", "sniffing": { "enabled": true, "destOverride": ["http", "tls"] } } ], "outbounds": [ { "protocol": "协议类别", "settings": {}, "tag": "Proxy", "streamSettings": {}, "mux": {} }, { "protocol": "dns", "tag": "Dns-Out" }, { "protocol": "freedom", "tag": "Direct", "settings": { "domainStrategy": "UseIPv4" } }, { "protocol": "blackhole", "tag": "Reject", "settings": { "response": { "type": "http" } } } ], "routing": { "domainStrategy": "IPIfNonMatch", "domainMatcher": "mph", "rules": [ { "type": "field", "outboundTag": "Direct", "protocol": ["bittorrent"] }, { "type": "field", "outboundTag": "Dns-Out", "inboundTag": ["Socks-In", "Http-In"], "network": "udp", "port": 53 }, { "type": "field", "outboundTag": "Reject", "domain": ["geosite:category-ads-all"] }, { "type": "field", "outboundTag": "Proxy", "domain": [ "full:www.icloud.com", "domain:icloud-content.com", "geosite:google" ] }, { "type": "field", "outboundTag": "Direct", "domain": [ "geosite:tld-cn", "geosite:icloud", "geosite:category-games@cn" ] }, { "type": "field", "outboundTag": "Proxy", "domain": ["geosite:geolocation-!cn"] }, { "type": "field", "outboundTag": "Direct", "domain": ["geosite:cn", "geosite:private"] }, { "type": "field", "outboundTag": "Direct", "ip": ["geoip:cn", "geoip:private"] }, { "type": "field", "outboundTag": "Proxy", "network": "tcp,udp" } ] } } ``` -------------------------------- ### Trojan-Go GeoIP Routing Configuration Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Configure Trojan-Go to use local geoip.dat and geosite.dat files for routing decisions. Place the dat files in the Trojan-Go program directory. ```json { "router": { "enabled": true, "bypass": ["geoip:cn"], "proxy": ["geoip:telegram", "geoip:us"], "block": ["geoip:jp"], "default_policy": "proxy", "geoip": "./geoip.dat", "geosite": "./geosite.dat" } } ``` -------------------------------- ### Whitelist Domain Routing with geosite.dat Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Implement whitelist routing using geosite.dat to direct China mainland and domestic domains directly, while routing all other traffic through a proxy. Ad domains are blocked. This is the recommended configuration for most users. ```json "routing": { "rules": [ { "type": "field", "outboundTag": "Reject", "domain": ["geosite:category-ads-all"] }, { "type": "field", "outboundTag": "Direct", "domain": [ "geosite:private", "geosite:apple-cn", "geosite:google-cn", "geosite:tld-cn", "geosite:category-games@cn" ] }, { "type": "field", "outboundTag": "Proxy", "domain": ["geosite:geolocation-!cn"] }, { "type": "field", "outboundTag": "Direct", "domain": ["geosite:cn"] }, { "type": "field", "outboundTag": "Proxy", "network": "tcp,udp" } ] } ``` -------------------------------- ### Mihomo geodata configuration Source: https://github.com/loyalsoldier/v2ray-rules-dat/blob/master/README.md Configure mihomo to use geodata mode and specify the URL for geoip.dat. Ensure the file is accessible at the provided URL. ```yaml geodata-mode: true geox-url: geoip: "https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geoip.dat" ``` -------------------------------- ### Trojan-Go geoip.dat configuration Source: https://github.com/loyalsoldier/v2ray-rules-dat/blob/master/README.md Configure Trojan-Go's router to use geoip.dat for bypass, proxy, and block rules. Ensure geoip.dat is in the program directory. ```json "router": { "enabled": true, "bypass": ["geoip:cn"], "proxy": ["geoip:telegram", "geoip:us"], "block": ["geoip:jp"], "default_policy": "proxy", "geoip": "./geoip.dat" } ``` -------------------------------- ### Advanced Attribute-Based Routing (@cn) Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Utilize attribute-based routing with the '@cn' tag for entries in v2fly/domain-list-community that have China mainland access points. This requires rules with '@cn' attributes to be placed before 'geosite:geolocation-!cn' for correct routing. ```json "routing": { "domainStrategy": "IPIfNonMatch", "domainMatcher": "mph", "rules": [ { "type": "field", "outboundTag": "Direct", "domain": [ "geosite:tld-cn", "geosite:icloud", "geosite:category-games@cn" ] }, { "type": "field", "outboundTag": "Proxy", "domain": [ "full:www.icloud.com", "domain:icloud-content.com", "geosite:google" ] }, { "type": "field", "outboundTag": "Proxy", "domain": ["geosite:geolocation-!cn"] }, { "type": "field", "outboundTag": "Direct", "domain": ["geosite:cn", "geosite:private"] }, { "type": "field", "outboundTag": "Direct", "ip": ["geoip:cn", "geoip:private"] } ] } ``` -------------------------------- ### Blacklist Domain Routing with geosite.dat Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Configure blacklist routing using geosite.dat to send only known blocked domains (GFWList) and specific IP ranges through the proxy, with all other traffic connecting directly. This mode is simpler but less precise than whitelist mode. ```json "routing": { "rules": [ { "type": "field", "outboundTag": "Reject", "domain": ["geosite:category-ads-all"] }, { "type": "field", "outboundTag": "Proxy", "domain": ["geosite:gfw"] }, { "type": "field", "outboundTag": "Proxy", "ip": ["geoip:telegram"] }, { "type": "field", "outboundTag": "Direct", "network": "tcp,udp" } ] } ``` -------------------------------- ### IP-Based Routing with geoip.dat Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Configure routing rules based on IP addresses using the geoip.dat file. This snippet shows how to direct traffic to 'Direct' or 'Proxy' outbound tags based on IP geolocation, including custom categories like 'geoip:cn' and 'geoip:private'. ```json "routing": { "rules": [ { "type": "field", "outboundTag": "Direct", "ip": [ "geoip:cn", "geoip:private", "ext:cn.dat:cn", "ext:private.dat:private", "ext:geoip-only-cn-private.dat:cn", "ext:geoip-only-cn-private.dat:private" ] }, { "type": "field", "outboundTag": "Proxy", "ip": [ "geoip:us", "geoip:jp", "geoip:facebook", "geoip:telegram", "ext:geoip-asn.dat:facebook", "ext:geoip-asn.dat:telegram" ] } ] } ``` -------------------------------- ### DNS Split Configuration Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Set up DNS split to resolve China mainland domains via domestic DNS servers and foreign domains via encrypted DNS, with IP-based validation to prevent DNS pollution. This configuration includes custom host mappings and server settings for different domain types. ```json "dns": { "hosts": { "dns.google": "8.8.8.8", "dns.pub": "119.29.29.29", "dns.alidns.com": "223.5.5.5", "geosite:category-ads-all": "127.0.0.1" }, "servers": [ { "address": "https://1.1.1.1/dns-query", "domains": ["geosite:geolocation-!cn"], "expectIPs": ["geoip:!cn"] }, "8.8.8.8", { "address": "114.114.114.114", "port": 53, "domains": ["geosite:cn", "geosite:category-games@cn"], "expectIPs": ["geoip:cn"], "skipFallback": true }, { "address": "localhost", "skipFallback": true } ] } ``` -------------------------------- ### Advanced geosite.dat usage with custom attributes Source: https://github.com/loyalsoldier/v2ray-rules-dat/blob/master/README.md Utilize custom attributes like '@cn' in geosite.dat for specific routing needs, such as direct access to Steam in China. Ensure these rules are prioritized in your routing configuration. ```plaintext steampowered.com.8686c.com @cn steamstatic.com.8686c.com @cn ``` -------------------------------- ### Hysteria ACL Rules with GeoIP Source: https://context7.com/loyalsoldier/v2ray-rules-dat/llms.txt Use geoip and geosite prefixes in hysteria's ACL configuration to define routing policies. Ensure geoip.dat is in the hysteria working directory. ```plaintext # hysteria ACL format direct(geoip:cn) direct(geoip:private) proxy(geoip:telegram) proxy(geoip:us) proxy(geoip:google) block(geosite:category-ads-all) proxy(all) ``` -------------------------------- ### Hysteria geoip.dat usage Source: https://github.com/loyalsoldier/v2ray-rules-dat/blob/master/README.md Use geoip.dat with hysteria for direct or proxy routing. Place the geoip.dat file in the hysteria program directory. ```plaintext direct(geoip:cn) proxy(geoip:telegram) proxy(geoip:us) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.