From 7015194877977989822bc5bc0c28c6e58d2acccb Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sun, 23 May 2021 17:04:07 +0530 Subject: [PATCH] minor refactoring done --- DnsServerCore/Dns/Zones/AuthZone.cs | 8 ++++---- DnsServerCore/Dns/Zones/AuthZoneInfo.cs | 22 ++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/DnsServerCore/Dns/Zones/AuthZone.cs b/DnsServerCore/Dns/Zones/AuthZone.cs index da25b6c8..9ad2c4c5 100644 --- a/DnsServerCore/Dns/Zones/AuthZone.cs +++ b/DnsServerCore/Dns/Zones/AuthZone.cs @@ -49,9 +49,9 @@ namespace DnsServerCore.Dns.Zones protected bool _disabled; protected AuthZoneTransfer _zoneTransfer; - protected IReadOnlyCollection _zoneTransferNameServers; + protected IReadOnlyCollection _zoneTransferNameServers; protected AuthZoneNotify _notify; - protected IReadOnlyCollection _notifyNameServers; + protected IReadOnlyCollection _notifyNameServers; #endregion @@ -474,7 +474,7 @@ namespace DnsServerCore.Dns.Zones set { _zoneTransfer = value; } } - public IReadOnlyCollection ZoneTransferNameServers + public IReadOnlyCollection ZoneTransferNameServers { get { return _zoneTransferNameServers; } set @@ -492,7 +492,7 @@ namespace DnsServerCore.Dns.Zones set { _notify = value; } } - public IReadOnlyCollection NotifyNameServers + public IReadOnlyCollection NotifyNameServers { get { return _notifyNameServers; } set diff --git a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs index d7e5feef..0e95d253 100644 --- a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs +++ b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs @@ -20,8 +20,10 @@ along with this program. If not, see . using System; using System.Collections.Generic; using System.IO; +using System.Net; using System.Threading.Tasks; using TechnitiumLibrary.IO; +using TechnitiumLibrary.Net; using TechnitiumLibrary.Net.Dns; namespace DnsServerCore.Dns.Zones @@ -45,9 +47,9 @@ namespace DnsServerCore.Dns.Zones readonly AuthZoneType _type; readonly bool _disabled; readonly AuthZoneTransfer _zoneTransfer; - readonly IReadOnlyCollection _zoneTransferNameServers; + readonly IReadOnlyCollection _zoneTransferNameServers; readonly AuthZoneNotify _notify; - readonly IReadOnlyCollection _notifyNameServers; + readonly IReadOnlyCollection _notifyNameServers; readonly DateTime _expiry; #endregion @@ -93,10 +95,10 @@ namespace DnsServerCore.Dns.Zones int count = bR.ReadByte(); if (count > 0) { - NameServerAddress[] nameServers = new NameServerAddress[count]; + IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) - nameServers[i] = new NameServerAddress(bR); + nameServers[i] = IPAddressExtension.Parse(bR); _zoneTransferNameServers = nameServers; } @@ -108,10 +110,10 @@ namespace DnsServerCore.Dns.Zones int count = bR.ReadByte(); if (count > 0) { - NameServerAddress[] nameServers = new NameServerAddress[count]; + IPAddress[] nameServers = new IPAddress[count]; for (int i = 0; i < count; i++) - nameServers[i] = new NameServerAddress(bR); + nameServers[i] = IPAddressExtension.Parse(bR); _notifyNameServers = nameServers; } @@ -272,7 +274,7 @@ namespace DnsServerCore.Dns.Zones else { bW.Write(Convert.ToByte(_zoneTransferNameServers.Count)); - foreach (NameServerAddress nameServer in _zoneTransferNameServers) + foreach (IPAddress nameServer in _zoneTransferNameServers) nameServer.WriteTo(bW); } @@ -285,7 +287,7 @@ namespace DnsServerCore.Dns.Zones else { bW.Write(Convert.ToByte(_notifyNameServers.Count)); - foreach (NameServerAddress nameServer in _notifyNameServers) + foreach (IPAddress nameServer in _notifyNameServers) nameServer.WriteTo(bW); } @@ -345,7 +347,7 @@ namespace DnsServerCore.Dns.Zones } } - public IReadOnlyCollection ZoneTransferNameServers + public IReadOnlyCollection ZoneTransferNameServers { get { return _zoneTransferNameServers; } set @@ -369,7 +371,7 @@ namespace DnsServerCore.Dns.Zones } } - public IReadOnlyCollection NotifyNameServers + public IReadOnlyCollection NotifyNameServers { get { return _notifyNameServers; } set