Theodicean.Makaretu.Dns.Multicast
0.0.1-pre8
See the version list below for details.
dotnet add package Theodicean.Makaretu.Dns.Multicast --version 0.0.1-pre8
NuGet\Install-Package Theodicean.Makaretu.Dns.Multicast -Version 0.0.1-pre8
<PackageReference Include="Theodicean.Makaretu.Dns.Multicast" Version="0.0.1-pre8" />
<PackageVersion Include="Theodicean.Makaretu.Dns.Multicast" Version="0.0.1-pre8" />
<PackageReference Include="Theodicean.Makaretu.Dns.Multicast" />
paket add Theodicean.Makaretu.Dns.Multicast --version 0.0.1-pre8
#r "nuget: Theodicean.Makaretu.Dns.Multicast, 0.0.1-pre8"
#:package Theodicean.Makaretu.Dns.Multicast@0.0.1-pre8
#addin nuget:?package=Theodicean.Makaretu.Dns.Multicast&version=0.0.1-pre8&prerelease
#tool nuget:?package=Theodicean.Makaretu.Dns.Multicast&version=0.0.1-pre8&prerelease
Forks from the following, but modernized and made async:
Buy the original author a coffee
<a href="https://www.buymeacoffee.com/kmXOxKJ4E" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>
net-dns
DNS data model with serializer/deserializer for the wire and "master file" format.
Features
- Serialization for the wire and master file formats
- Pretty printing of messages
- Supports compressed domain names
- Supports multiple strings in TXT records
- Supports the extended 12-bit RCODE
- Future proof: handles unknown resource records and EDNS options
- Graceful truncation of messages
- A name server that answeres DNS questions
- Data models for
- RFC 1035 Domain Names (DNS)
- RFC 1183 New DNS RR Definitions
- RFC 1996 Zone Changes (DNS NOTIFY)
- RFC 2136 Dynamic Updates (DNS UPDATE)
- RFC 2845 Secret Key Transaction Authentication for DNS (TSIG)
- RFC 2930 Secret Key Establishment for DNS (TKEY RR)
- RFC 3225 Indicating Resolver Support of DNSSEC
- RFC 3599 DNS Extensions to Support IPv6
- RFC 4034 Resource Records for the DNS Security Extensions (DNSSEC)
- RFC 5001 DNS Name Server Identifier (NSID) Option
- RFC 6672 DNAME Redirection in the DNS
- RFC 6891 Extension Mechanisms for DNS (EDNS(0))
- RFC 7828 The edns-tcp-keepalive EDNS0 Option
- RFC 7830 The EDNS(0) Padding Option
- Targets .Net Framework 4.5 and 4.7.2 and .NET Standard 1.4 and 2.0
- CI on Travis (Ubuntu Trusty and OSX) and AppVeyor (Windows Server 2016)
Getting started
Published releases are available on NuGet. To install, run the following command in the Package Manager Console.
PM> Install-Package Theodicean.Makaretu.Dns
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
- net-mdns - client and server for multicast DNS
- net-udns - client for unicast DNS, DNS over HTTPS (DOH) and DNS over TLS (DOT)
- DNSSEC - What Is It and Why Is It Important?
License
Copyright © 2018 Richard Schneider (makaretu@gmail.com)
The package is licensed under the MIT license. Refer to the LICENSE file for more information.
net-mdns
A simple Multicast Domain Name Service based on RFC 6762. Can be used as both a client (sending queries) or a server (responding to queries).
A higher level DNS Service Discovery based on RFC 6763 that automatically responds to any query for the service or service instance.
Features
- Targets Framework 4.6.1, .NET Standard 1.4 and 2.0
- Supports IPv6 and IPv4 platforms
- CI on Circle (Debian GNU/Linux), Travis (Ubuntu Xenial and OSX) and AppVeyor (Windows Server 2016)
- Detects new and/or removed network interfaces
- Supports multicasting on multiple network interfaces
- Supports reverse address mapping
- Supports service subtypes (features)
- Handles legacy unicast queries, see #61
Getting started
Published releases are available on NuGet. To install, run the following command in the Package Manager Console
PM> Install-Package Theodicean.Makaretu.Dns.Multicast
or using .NET CLI run the following command in the project folder
> dotnet add package Theodicean.Makaretu.Dns.Multicast
Usage Service Discovery
Advertising
Always broadcast the service ("foo") running on local host with port 1024.
using Makaretu.Dns;
var service = new ServiceProfile("x", "_foo._tcp", 1024);
var sd = new ServiceDiscovery();
sd.Advertise(service);
See the example advertiser for a working program.
Discovery
Find all services running on the local link.
using Makaretu.Dns;
var sd = new ServiceDiscovery();
sd.ServiceDiscovered += (s, serviceName) => { // Do something };
Find all service instances running on the local link.
using Makaretu.Dns;
var sd = new ServiceDiscovery();
sd.ServiceInstanceDiscovered += (s, e) => { // Do something };
See the example browser for a working program.
Usage Multicast
Event Based Queries
Get all the Apple TVs. The query is sent when a network interface is discovered.
The AnsweredReceived
callback contains any answer that is seen, not just the answer
to the specific query.
using Makaretu.Dns;
var mdns = new MulticastService();
mdns.NetworkInterfaceDiscovered += (s, e) => mdns.SendQuery("appletv.local");
mdns.AnswerReceived += (s, e) => { // do something with e.Message };
mdns.Start();
Async Queries
Get the first answer to Apple TVs. Wait 2 seconds for an answer.
using Makaretu.Dns;
var service = "appletv.local";
var query = new Message();
query.Questions.Add(new Question { Name = service, Type = DnsType.ANY });
var cancellation = new CancellationTokenSource(2000);
using (var mdns = new MulticastService())
{
mdns.Start();
var response = await mdns.ResolveAsync(query, cancellation.Token);
// Do something
}
Broadcasting
Respond to a query for the service. Note that ServiceDiscovery.Advertise
is much easier.
using Makaretu.Dns;
var service = "...";
var mdns = new MulticastService();
mdns.QueryReceived += (s, e) =>
{
var msg = e.Message;
if (msg.Questions.Any(q => q.Name == service))
{
var res = msg.CreateResponse();
var addresses = MulticastService.GetIPAddresses()
.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork);
foreach (var address in addresses)
{
res.Answers.Add(new ARecord
{
Name = service,
Address = address
});
}
mdns.SendAnswer(res);
}
};
mdns.Start();
Related projects
- net-dns - DNS data model and Name Server with serializer for the wire and master file format
- net-udns - client for unicast DNS, DNS over HTTPS (DOH) and DNS over TLS (DOT)
License
Copyright © 2018-2019 Richard Schneider (makaretu@gmail.com)
The package is licensed under the MIT license. Refer to the LICENSE file for more information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.8)
- Theodicean.Makaretu.Dns (>= 0.0.1-pre8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
0.0.1 | 11 | 8/10/2025 |
0.0.1-pre8 | 13 | 8/10/2025 |
0.0.1-pre7 | 13 | 8/10/2025 |
0.0.1-pre6 | 39 | 8/9/2025 |