Skip to content

Commit

Permalink
Built-in routing rule set upgraded to V2
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Apr 10, 2024
1 parent 5c0c07c commit d961ea2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
9 changes: 5 additions & 4 deletions v2rayN/v2rayN/Handler/ConfigHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1674,14 +1674,15 @@ public static RoutingItem GetDefaultRouting(Config config)

public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
{
var ver = "V2-";
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;
//Bypass the mainland
var item2 = new RoutingItem()
{
remarks = "绕过大陆(Whitelist)",
remarks = $"{ver}绕过大陆(Whitelist)",
url = string.Empty,
sort = maxSort + 1,
};
Expand All @@ -1690,7 +1691,7 @@ public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules =
//Blacklist
var item3 = new RoutingItem()
{
remarks = "黑名单(Blacklist)",
remarks = $"{ver}黑名单(Blacklist)",
url = string.Empty,
sort = maxSort + 2,
};
Expand All @@ -1699,7 +1700,7 @@ public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules =
//Global
var item1 = new RoutingItem()
{
remarks = "全局(Global)",
remarks = $"{ver}全局(Global)",
url = string.Empty,
sort = maxSort + 3,
};
Expand Down
16 changes: 3 additions & 13 deletions v2rayN/v2rayN/Sample/custom_routing_black
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,10 @@
},
{
"outboundTag": "proxy",
"ip": [
"geoip:cloudflare",
"geoip:cloudfront",
"geoip:facebook",
"geoip:fastly",
"geoip:google",
"geoip:netflix",
"geoip:telegram",
"geoip:twitter"
],

"domain": [
"geosite:gfw",
"geosite:greatfire",
"geosite:tld-!cn"
"geosite:geolocation-!cn",
"geosite:greatfire"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion v2rayN/v2rayN/Sample/custom_routing_white
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
{
"outboundTag": "direct",
"domain": [
"geosite:cn"
"geosite:cn",
"geosite:geolocation-cn"
]
},
{
Expand Down
3 changes: 2 additions & 1 deletion v2rayN/v2rayN/Sample/dns_v2ray_normal
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{
"address": "223.5.5.5",
"domains": [
"geosite:cn"
"geosite:cn",
"geosite:geolocation-cn"
],
"expectIPs": [
"geoip:cn"
Expand Down

0 comments on commit d961ea2

Please sign in to comment.