DnsBlacklist.cs 968 B

123456789101112131415161718192021222324252627282930
  1. using System.Text.RegularExpressions;
  2. namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
  3. {
  4. static class DnsBlacklist
  5. {
  6. const RegexOptions RegexOpts = RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture | RegexOptions.Compiled;
  7. private static readonly Regex[] BlockedHosts = new Regex[]
  8. {
  9. new Regex(@"^g(.*)\-lp1\.s\.n\.srv\.nintendo\.net$", RegexOpts),
  10. new Regex(@"^(.*)\-sb\-api\.accounts\.nintendo\.com$", RegexOpts),
  11. new Regex(@"^(.*)\-sb\.accounts\.nintendo\.com$", RegexOpts),
  12. new Regex(@"^accounts\.nintendo\.com$", RegexOpts)
  13. };
  14. public static bool IsHostBlocked(string host)
  15. {
  16. foreach (Regex regex in BlockedHosts)
  17. {
  18. if (regex.IsMatch(host))
  19. {
  20. return true;
  21. }
  22. }
  23. return false;
  24. }
  25. }
  26. }