DnsServer: implemented enable blocking feature.

This commit is contained in:
Shreyas Zare
2021-05-30 16:39:54 +05:30
parent dec9e28648
commit fd41f8de63

View File

@@ -131,6 +131,7 @@ namespace DnsServerCore.Dns
int _cachePrefetchTrigger = 9;
int _cachePrefetchSampleIntervalInMinutes = 5;
int _cachePrefetchSampleEligibilityHitsPerHour = 30;
bool _enableBlocking = true;
DnsServerBlockingType _blockingType = DnsServerBlockingType.AnyAddress;
IReadOnlyCollection<DnsARecord> _customBlockingARecords = Array.Empty<DnsARecord>();
IReadOnlyCollection<DnsAAAARecord> _customBlockingAAAARecords = Array.Empty<DnsAAAARecord>();
@@ -1723,6 +1724,10 @@ namespace DnsServerCore.Dns
//this is since a blocked CNAME record could still be used by an allowed domain name and so must resolve
inAllowedZone = true;
}
else if (!_enableBlocking)
{
inAllowedZone = true;
}
else
{
inAllowedZone = (_allowedZoneManager.TotalZonesAllowed > 0) && (_allowedZoneManager.Query(request) is not null);
@@ -3197,6 +3202,12 @@ namespace DnsServerCore.Dns
}
}
public bool EnableBlocking
{
get { return _enableBlocking; }
set { _enableBlocking = value; }
}
public DnsServerBlockingType BlockingType
{
get { return _blockingType; }