DNS data model and Name Server with serializer for the wire and master file format
DNS data model with serializer/deserializer for the wire and "master file" format.
Published releases are available on NuGet. To install, run the following command in the Package Manager Console.
PM> Install-Package Makaretu.Dns
Create a name server that can answer questions for a zone.
using Makaretu.Dns.Resolving;
var catalog = new Catalog();
catalog.IncludeZone(...);
catalog.IncludeRootHints();
var resolver = new NameServer { Catalog = catalog };
Answer a question
var request = new Message();
request.Questions.Add(new Question { Name = "ns.example.com", Type = DnsType.AAAA });
var response = await resolver.ResolveAsync(request);
using Makaretu.Dns
var msg = new Message
{
AA = true,
QR = true,
Id = 1234
};
msg.Questions.Add(new Question
{
Name = "emanon.org"
});
msg.Answers.Add(new ARecord
{
Name = "emanon.org",
Address = IPAddress.Parse("127.0.0.1")
});
msg.AuthorityRecords.Add(new SOARecord
{
Name = "emanon.org",
PrimaryName = "erehwon",
Mailbox = "hostmaster.emanon.org"
});
msg.AdditionalRecords.Add(new ARecord
{
Name = "erehwon",
Address = IPAddress.Parse("127.0.0.1")
});
Copyright © 2018 Richard Schneider ([email protected])
The package is licensed under the MIT license. Refer to the LICENSE file for more information.