mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 13:13:04 +00:00
Move default filter to Global
This commit is contained in:
parent
58e3824d67
commit
9828b07935
2 changed files with 10 additions and 18 deletions
|
|
@ -90,6 +90,10 @@ public class Global
|
||||||
|
|
||||||
public const int Hysteria2DefaultHopInt = 10;
|
public const int Hysteria2DefaultHopInt = 10;
|
||||||
|
|
||||||
|
public const string PolicyGroupExcludeKeywords = @"剩余|过期|到期|重置|[Rr]emaining|[Ee]xpir|[Rr]eset";
|
||||||
|
|
||||||
|
public const string PolicyGroupDefaultAllFilter = $"^(?!.*(?:{PolicyGroupExcludeKeywords})).*$";
|
||||||
|
|
||||||
public static readonly List<string> IEProxyProtocols =
|
public static readonly List<string> IEProxyProtocols =
|
||||||
[
|
[
|
||||||
"{ip}:{http_port}",
|
"{ip}:{http_port}",
|
||||||
|
|
|
||||||
|
|
@ -1163,23 +1163,6 @@ public static class ConfigHandler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches subscription-info noise words in both Chinese and English.
|
|
||||||
// Chinese: 剩余(remaining), 过期/到期(expired/expiry), 重置(reset)
|
|
||||||
// English: remaining, expir(e/ed/y), reset
|
|
||||||
private const string PolicyGroupExcludeKeywords = @"剩余|过期|到期|重置|[Rr]emaining|[Ee]xpir|[Rr]eset";
|
|
||||||
|
|
||||||
private const string PolicyGroupDefaultAllFilter = $"^(?!.*(?:{PolicyGroupExcludeKeywords})).*$";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Combines a region pattern with PolicyGroupDefaultAllFilter so results must
|
|
||||||
/// match the region keyword AND not contain expiry/traffic noise words (CN + EN).
|
|
||||||
/// Result pattern: ^(?!.*(?:...excludeKeywords...)).*(?:regionPattern).*$
|
|
||||||
/// </summary>
|
|
||||||
private static string CombineWithDefaultAllFilter(string regionPattern)
|
|
||||||
{
|
|
||||||
return $"^(?!.*(?:{PolicyGroupExcludeKeywords})).*(?:{regionPattern}).*$";
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a group server that combines multiple servers for load balancing
|
/// Create a group server that combines multiple servers for load balancing
|
||||||
/// Generates a PolicyGroup profile with references to the sub-items
|
/// Generates a PolicyGroup profile with references to the sub-items
|
||||||
|
|
@ -1217,7 +1200,7 @@ public static class ConfigHandler
|
||||||
MultipleLoad = EMultipleLoad.LeastPing,
|
MultipleLoad = EMultipleLoad.LeastPing,
|
||||||
GroupType = profile.ConfigType.ToString(),
|
GroupType = profile.ConfigType.ToString(),
|
||||||
SubChildItems = subId,
|
SubChildItems = subId,
|
||||||
Filter = PolicyGroupDefaultAllFilter,
|
Filter = Global.PolicyGroupDefaultAllFilter,
|
||||||
};
|
};
|
||||||
profile.SetProtocolExtra(extraItem);
|
profile.SetProtocolExtra(extraItem);
|
||||||
var ret = await AddServerCommon(config, profile, true);
|
var ret = await AddServerCommon(config, profile, true);
|
||||||
|
|
@ -1226,6 +1209,11 @@ public static class ConfigHandler
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string CombineWithDefaultAllFilter(string regionPattern)
|
||||||
|
{
|
||||||
|
return $"^(?!.*(?:{Global.PolicyGroupExcludeKeywords})).*(?:{regionPattern}).*$";
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> PolicyGroupRegionFilters = new()
|
private static readonly Dictionary<string, string> PolicyGroupRegionFilters = new()
|
||||||
{
|
{
|
||||||
{ "JP", "日本|\\b[Jj][Pp]\\b|🇯🇵|[Jj]apan" },
|
{ "JP", "日本|\\b[Jj][Pp]\\b|🇯🇵|[Jj]apan" },
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue