Home

Awesome

net-dns

Build Version docs

DNS data model with serializer/deserializer for the wire and "master file" format.

Features

Getting started

Published releases are available on NuGet. To install, run the following command in the Package Manager Console.

PM> Install-Package Makaretu.Dns.New

Usage

Name Server

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);

Data Model

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") 
});

Related projects

License

Copyright © 2018 Richard Schneider (makaretu@gmail.com)

The package is licensed under the MIT license. Refer to the LICENSE file for more information.