mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2025-12-22 09:29:50 +00:00
DnsWebService: updated logging for block list with additional details.
This commit is contained in:
@@ -2844,6 +2844,8 @@ namespace DnsServerCore
|
|||||||
File.Delete(blockListFilePath);
|
File.Delete(blockListFilePath);
|
||||||
|
|
||||||
File.Move(blockListDownloadFilePath, blockListFilePath);
|
File.Move(blockListDownloadFilePath, blockListFilePath);
|
||||||
|
|
||||||
|
_log.Write("DNS Server successfully downloaded block list (" + WebUtilities.GetFormattedSize(new FileInfo(blockListFilePath).Length) + "): " + blockListUrl.AbsoluteUri);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2856,6 +2858,8 @@ namespace DnsServerCore
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
using (BufferedStream bS = new BufferedStream(new FileStream(blockListFilePath, FileMode.Open, FileAccess.Read)))
|
using (BufferedStream bS = new BufferedStream(new FileStream(blockListFilePath, FileMode.Open, FileAccess.Read)))
|
||||||
{
|
{
|
||||||
//parse hosts file and populate block zone
|
//parse hosts file and populate block zone
|
||||||
@@ -2920,11 +2924,14 @@ namespace DnsServerCore
|
|||||||
ipAddress = IPAddress.Any;
|
ipAddress = IPAddress.Any;
|
||||||
|
|
||||||
if (ipAddress.Equals(IPAddress.Any) || ipAddress.Equals(IPAddress.Loopback) || ipAddress.Equals(IPAddress.IPv6Any) || ipAddress.Equals(IPAddress.IPv6Loopback))
|
if (ipAddress.Equals(IPAddress.Any) || ipAddress.Equals(IPAddress.Loopback) || ipAddress.Equals(IPAddress.IPv6Any) || ipAddress.Equals(IPAddress.IPv6Loopback))
|
||||||
|
{
|
||||||
BlockZone(hostname, blockedZoneRoot);
|
BlockZone(hostname, blockedZoneRoot);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_log.Write("DNS Server blocked zone was updated from: " + blockListUrl.AbsoluteUri);
|
_log.Write("DNS Server blocked zone was updated (" + count + " domains) from: " + blockListUrl.AbsoluteUri);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user