2021-03-24 18:43:23 +01:00
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres.Proxy
|
|
|
|
|
{
|
2022-12-04 01:43:23 +01:00
|
|
|
|
static partial class DnsBlacklist
|
2021-03-24 18:43:23 +01:00
|
|
|
|
{
|
2022-12-04 01:43:23 +01:00
|
|
|
|
const RegexOptions RegexOpts = RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture;
|
2021-03-30 00:55:53 +02:00
|
|
|
|
|
2022-12-04 01:43:23 +01:00
|
|
|
|
[GeneratedRegex(@"^(.*)\-lp1\.(n|s)\.n\.srv\.nintendo\.net$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost1();
|
|
|
|
|
[GeneratedRegex(@"^(.*)\-lp1\.lp1\.t\.npln\.srv\.nintendo\.net$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost2();
|
|
|
|
|
[GeneratedRegex(@"^(.*)\-lp1\.(znc|p)\.srv\.nintendo\.net$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost3();
|
|
|
|
|
[GeneratedRegex(@"^(.*)\-sb\-api\.accounts\.nintendo\.com$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost4();
|
|
|
|
|
[GeneratedRegex(@"^(.*)\-sb\.accounts\.nintendo\.com$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost5();
|
|
|
|
|
[GeneratedRegex(@"^accounts\.nintendo\.com$", RegexOpts)]
|
|
|
|
|
private static partial Regex BlockedHost6();
|
|
|
|
|
|
|
|
|
|
private static readonly Regex[] BlockedHosts = {
|
|
|
|
|
BlockedHost1(),
|
|
|
|
|
BlockedHost2(),
|
|
|
|
|
BlockedHost3(),
|
|
|
|
|
BlockedHost4(),
|
|
|
|
|
BlockedHost5(),
|
|
|
|
|
BlockedHost6()
|
2021-03-24 18:43:23 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static bool IsHostBlocked(string host)
|
|
|
|
|
{
|
|
|
|
|
foreach (Regex regex in BlockedHosts)
|
|
|
|
|
{
|
|
|
|
|
if (regex.IsMatch(host))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|