Publish Zonghengjia Windows 0.3.17 client source
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace UCVL.VPNPlus;
|
||||
|
||||
// These namespaces carry the control, relay and MagicDNS traffic that the
|
||||
// Tailscale transport itself depends on.
|
||||
internal static class TailnetDnsPolicy
|
||||
{
|
||||
private static readonly string[] Zones = ["tailscale.com", "ts.net"];
|
||||
internal static readonly string DomainPattern = @"(?i)(^|\.)(" + string.Join("|", Zones.Select(Regex.Escape)) + @")\.?$";
|
||||
private static readonly Regex ProtectedDomain = new(DomainPattern, RegexOptions.CultureInvariant);
|
||||
|
||||
internal static bool IsProtectedDomain(string domain) => ProtectedDomain.IsMatch(domain);
|
||||
|
||||
internal static bool IsProtectedSuffix(string suffix) => IsProtectedDomain(suffix)
|
||||
|| Zones.Any(zone => zone.EndsWith("." + suffix.TrimEnd('.'), StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
Reference in New Issue
Block a user