Built-in routing rule set upgraded to V2

This commit is contained in:
2dust 2024-04-10 10:50:52 +08:00
parent 5c0c07c78f
commit d961ea22a6
4 changed files with 12 additions and 19 deletions

View file

@ -1674,14 +1674,15 @@ namespace v2rayN.Handler
public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false) public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
{ {
var ver = "V2-";
var items = LazyConfig.Instance.RoutingItems(); var items = LazyConfig.Instance.RoutingItems();
if (blImportAdvancedRules || items.Count <= 0) if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(ver)).ToList().Count <= 0)
{ {
var maxSort = items.Count; var maxSort = items.Count;
//Bypass the mainland //Bypass the mainland
var item2 = new RoutingItem() var item2 = new RoutingItem()
{ {
remarks = "绕过大陆(Whitelist)", remarks = $"{ver}绕过大陆(Whitelist)",
url = string.Empty, url = string.Empty,
sort = maxSort + 1, sort = maxSort + 1,
}; };
@ -1690,7 +1691,7 @@ namespace v2rayN.Handler
//Blacklist //Blacklist
var item3 = new RoutingItem() var item3 = new RoutingItem()
{ {
remarks = "黑名单(Blacklist)", remarks = $"{ver}黑名单(Blacklist)",
url = string.Empty, url = string.Empty,
sort = maxSort + 2, sort = maxSort + 2,
}; };
@ -1699,7 +1700,7 @@ namespace v2rayN.Handler
//Global //Global
var item1 = new RoutingItem() var item1 = new RoutingItem()
{ {
remarks = "全局(Global)", remarks = $"{ver}全局(Global)",
url = string.Empty, url = string.Empty,
sort = maxSort + 3, sort = maxSort + 3,
}; };

View file

@ -13,20 +13,10 @@
}, },
{ {
"outboundTag": "proxy", "outboundTag": "proxy",
"ip": [
"geoip:cloudflare",
"geoip:cloudfront",
"geoip:facebook",
"geoip:fastly",
"geoip:google",
"geoip:netflix",
"geoip:telegram",
"geoip:twitter"
],
"domain": [ "domain": [
"geosite:gfw", "geosite:geolocation-!cn",
"geosite:greatfire", "geosite:greatfire"
"geosite:tld-!cn"
] ]
}, },
{ {

View file

@ -15,7 +15,8 @@
{ {
"outboundTag": "direct", "outboundTag": "direct",
"domain": [ "domain": [
"geosite:cn" "geosite:cn",
"geosite:geolocation-cn"
] ]
}, },
{ {

View file

@ -7,7 +7,8 @@
{ {
"address": "223.5.5.5", "address": "223.5.5.5",
"domains": [ "domains": [
"geosite:cn" "geosite:cn",
"geosite:geolocation-cn"
], ],
"expectIPs": [ "expectIPs": [
"geoip:cn" "geoip:cn"