diff --git a/DnsServerCore/Dns/Zones/ApplicationSubDomainZone.cs b/DnsServerCore/Dns/Zones/ApplicationSubDomainZone.cs
deleted file mode 100644
index d4b11bca..00000000
--- a/DnsServerCore/Dns/Zones/ApplicationSubDomainZone.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-Technitium DNS Server
-Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com)
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-*/
-
-using System.Collections.Generic;
-using TechnitiumLibrary.Net.Dns;
-
-namespace DnsServerCore.Dns.Zones
-{
- class ApplicationSubDomainZone : SubDomainZone
- {
- #region variables
-
- readonly ApplicationZone _applicationZone;
-
- #endregion
-
- #region constructor
-
- public ApplicationSubDomainZone(ApplicationZone applicationZone, string name)
- : base(name)
- {
- _applicationZone = applicationZone;
- }
-
- #endregion
-
- #region public
-
- public override void SetRecords(DnsResourceRecordType type, IReadOnlyList records)
- {
- base.SetRecords(type, records);
-
- _applicationZone.IncrementSoaSerial();
- }
-
- public override void AddRecord(DnsResourceRecord record)
- {
- base.AddRecord(record);
-
- _applicationZone.IncrementSoaSerial();
- }
-
- public override bool DeleteRecords(DnsResourceRecordType type)
- {
- if (base.DeleteRecords(type))
- {
- _applicationZone.IncrementSoaSerial();
-
- return true;
- }
-
- return false;
- }
-
- public override bool DeleteRecord(DnsResourceRecordType type, DnsResourceRecordData record)
- {
- if (base.DeleteRecord(type, record))
- {
- _applicationZone.IncrementSoaSerial();
-
- return true;
- }
-
- return false;
- }
-
- #endregion
- }
-}
diff --git a/DnsServerCore/Dns/Zones/ApplicationZone.cs b/DnsServerCore/Dns/Zones/ApplicationZone.cs
deleted file mode 100644
index 2d430d08..00000000
--- a/DnsServerCore/Dns/Zones/ApplicationZone.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-Technitium DNS Server
-Copyright (C) 2021 Shreyas Zare (shreyas@technitium.com)
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see .
-
-*/
-
-using System;
-using System.Collections.Generic;
-using TechnitiumLibrary.Net.Dns;
-using TechnitiumLibrary.Net.Dns.ResourceRecords;
-
-namespace DnsServerCore.Dns.Zones
-{
- class ApplicationZone : AuthZone
- {
- #region constructor
-
- public ApplicationZone(AuthZoneInfo zoneInfo)
- : base(zoneInfo.Name)
- {
- _disabled = zoneInfo.Disabled;
- }
-
- public ApplicationZone(string name, string primaryNameServer, string appName, string classPath, string data)
- : base(name)
- {
- DnsSOARecord soa = new DnsSOARecord(primaryNameServer, _name.Length == 0 ? "hostadmin" : "hostadmin." + _name, 1, 14400, 3600, 604800, 900);
-
- _entries[DnsResourceRecordType.SOA] = new DnsResourceRecord[] { new DnsResourceRecord(_name, DnsResourceRecordType.SOA, DnsClass.IN, soa.Refresh, soa) };
- _entries[DnsResourceRecordType.NS] = new DnsResourceRecord[] { new DnsResourceRecord(_name, DnsResourceRecordType.NS, DnsClass.IN, soa.Refresh, new DnsNSRecord(soa.PrimaryNameServer)) };
-
- DnsResourceRecord appRecord = new DnsResourceRecord(name, DnsResourceRecordType.APP, DnsClass.IN, 60, new DnsApplicationRecord(appName, classPath, data));
-
- _entries[DnsResourceRecordType.APP] = new DnsResourceRecord[] { appRecord };
- }
-
- #endregion
-
- #region public
-
- public void IncrementSoaSerial()
- {
- DnsResourceRecord record = _entries[DnsResourceRecordType.SOA][0];
- DnsSOARecord soa = record.RDATA as DnsSOARecord;
-
- uint serial = soa.Serial;
- if (serial < uint.MaxValue)
- serial++;
- else
- serial = 0;
-
- DnsResourceRecord newRecord = new DnsResourceRecord(record.Name, record.Type, record.Class, record.TtlValue, new DnsSOARecord(soa.PrimaryNameServer, soa.ResponsiblePerson, serial, soa.Refresh, soa.Retry, soa.Expire, soa.Minimum)) { Tag = record.Tag };
- _entries[DnsResourceRecordType.SOA] = new DnsResourceRecord[] { newRecord };
- }
-
- public override void SetRecords(DnsResourceRecordType type, IReadOnlyList records)
- {
- switch (type)
- {
- case DnsResourceRecordType.CNAME:
- throw new InvalidOperationException("Cannot set CNAME record to zone root.");
-
- case DnsResourceRecordType.SOA:
- if ((records.Count != 1) || !records[0].Name.Equals(_name, StringComparison.OrdinalIgnoreCase))
- throw new InvalidOperationException("Invalid SOA record.");
-
- //remove any resource record info
- records[0].Tag = null;
- break;
- }
-
- base.SetRecords(type, records);
-
- IncrementSoaSerial();
- }
-
- public override void AddRecord(DnsResourceRecord record)
- {
- if (record.Type == DnsResourceRecordType.APP)
- throw new InvalidOperationException("Cannot add record: use SetRecords() for " + record.Type.ToString() + " record");
-
- base.AddRecord(record);
-
- IncrementSoaSerial();
- }
-
- public override bool DeleteRecords(DnsResourceRecordType type)
- {
- if (type == DnsResourceRecordType.SOA)
- throw new InvalidOperationException("Cannot delete SOA record.");
-
- if (base.DeleteRecords(type))
- {
- IncrementSoaSerial();
-
- return true;
- }
-
- return false;
- }
-
- public override bool DeleteRecord(DnsResourceRecordType type, DnsResourceRecordData record)
- {
- if (type == DnsResourceRecordType.SOA)
- throw new InvalidOperationException("Cannot delete SOA record.");
-
- if (base.DeleteRecord(type, record))
- {
- IncrementSoaSerial();
-
- return true;
- }
-
- return false;
- }
-
- #endregion
- }
-}
diff --git a/DnsServerCore/Dns/Zones/AuthZone.cs b/DnsServerCore/Dns/Zones/AuthZone.cs
index a978684b..a48c720b 100644
--- a/DnsServerCore/Dns/Zones/AuthZone.cs
+++ b/DnsServerCore/Dns/Zones/AuthZone.cs
@@ -96,7 +96,7 @@ namespace DnsServerCore.Dns.Zones
return newRecords;
}
- private async Task> GetNameServerAddressesAsync(DnsServer dnsServer, DnsResourceRecord record)
+ private static async Task> GetNameServerAddressesAsync(DnsServer dnsServer, DnsResourceRecord record)
{
string nsDomain;
@@ -243,9 +243,9 @@ namespace DnsServerCore.Dns.Zones
}
//set new entries into zone
- if ((this is ForwarderZone) || (this is ApplicationZone))
+ if (this is ForwarderZone)
{
- //skip NS and SOA records from being added to ForwarderZone or ApplicationZone
+ //skip NS and SOA records from being added to ForwarderZone
foreach (KeyValuePair> newEntry in newEntries)
{
switch (newEntry.Key)
diff --git a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs
index 1dff3368..32d4c7a9 100644
--- a/DnsServerCore/Dns/Zones/AuthZoneInfo.cs
+++ b/DnsServerCore/Dns/Zones/AuthZoneInfo.cs
@@ -32,8 +32,7 @@ namespace DnsServerCore.Dns.Zones
Primary = 1,
Secondary = 2,
Stub = 3,
- Forwarder = 4,
- Application = 5
+ Forwarder = 4
}
public sealed class AuthZoneInfo : IComparable
@@ -98,8 +97,6 @@ namespace DnsServerCore.Dns.Zones
_type = AuthZoneType.Stub;
else if (_zone is ForwarderZone)
_type = AuthZoneType.Forwarder;
- else if (_zone is ApplicationZone)
- _type = AuthZoneType.Application;
else
_type = AuthZoneType.Unknown;
diff --git a/DnsServerCore/Dns/Zones/ZoneTree.cs b/DnsServerCore/Dns/Zones/ZoneTree.cs
index 8b5d7929..e0952c37 100644
--- a/DnsServerCore/Dns/Zones/ZoneTree.cs
+++ b/DnsServerCore/Dns/Zones/ZoneTree.cs
@@ -53,7 +53,7 @@ namespace DnsServerCore.Dns.Zones
if (zone is SubDomainZone)
return child; //child has value so return it
- if ((zone is PrimaryZone) || (zone is SecondaryZone) || (zone is StubZone) || (zone is ForwarderZone) || (zone is ApplicationZone))
+ if ((zone is PrimaryZone) || (zone is SecondaryZone) || (zone is StubZone) || (zone is ForwarderZone))
{
//skip to next child to avoid listing this auth zone's sub domains
child = null; //set null to avoid child being set as current after the loop
@@ -262,7 +262,7 @@ namespace DnsServerCore.Dns.Zones
{
if (zoneValue is AuthZone)
{
- if ((zoneValue is PrimaryZone) || (zoneValue is SecondaryZone) || (zoneValue is StubZone) || (zoneValue is ForwarderZone) || (zoneValue is ApplicationZone))
+ if ((zoneValue is PrimaryZone) || (zoneValue is SecondaryZone) || (zoneValue is StubZone) || (zoneValue is ForwarderZone))
{
if (IsKeySubDomain(value.Key, key))
{
@@ -435,7 +435,7 @@ namespace DnsServerCore.Dns.Zones
{
if (TryRemove(domain, out value, out Node closestNode))
{
- if ((value != null) && ((value is PrimaryZone) || (value is SecondaryZone) || (value is StubZone) || (value is ForwarderZone) || (value is ApplicationZone)))
+ if ((value != null) && ((value is PrimaryZone) || (value is SecondaryZone) || (value is StubZone) || (value is ForwarderZone)))
{
//remove all sub domains under current zone
Node current = closestNode;
@@ -483,7 +483,7 @@ namespace DnsServerCore.Dns.Zones
T zone = nodeValue.Value;
if (zone != null)
{
- if ((zone is PrimaryZone) || (zone is SecondaryZone) || (zone is StubZone) || (zone is ForwarderZone) || (zone is ApplicationZone))
+ if ((zone is PrimaryZone) || (zone is SecondaryZone) || (zone is StubZone) || (zone is ForwarderZone))
{
zones.Add(zone);
@@ -606,7 +606,7 @@ namespace DnsServerCore.Dns.Zones
//zone found
if (zoneValue is AuthZone)
{
- if ((zoneValue is PrimaryZone) || (zoneValue is SecondaryZone) || (zoneValue is StubZone) || (zoneValue is ForwarderZone) || (zoneValue is ApplicationZone))
+ if ((zoneValue is PrimaryZone) || (zoneValue is SecondaryZone) || (zoneValue is StubZone) || (zoneValue is ForwarderZone))
{
delegation = null;
authority = zoneValue;