DotnetDNS 0.0.1-alpha
This is a prerelease version of DotnetDNS.
dotnet add package DotnetDNS --version 0.0.1-alpha
NuGet\Install-Package DotnetDNS -Version 0.0.1-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotnetDNS" Version="0.0.1-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotnetDNS" Version="0.0.1-alpha" />
<PackageReference Include="DotnetDNS" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DotnetDNS --version 0.0.1-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotnetDNS, 0.0.1-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DotnetDNS@0.0.1-alpha
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DotnetDNS&version=0.0.1-alpha&prerelease
#tool nuget:?package=DotnetDNS&version=0.0.1-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DotnetDNS
This package allows you to parse a byte array from data sent from a DNS request into comsumable classes and enums. You may then use that request to construct a DNS Response which has a Data property of a byte array type which can be sent back to the endpoint which sent the request.
Features
- DNS Parsing of raw
byte[]
into consumable classes - A and AAAA record support
- Cross platform
Usage/Examples
Written in .net6
using DotnetDNS;
using System.Net;
public static async Task Main(string[] args)
{
var client = new UdpClient(2022);
while (true)
{
var request = await client.ReceiveAsync();
var dnsRequest = new DNSRequest(request.Buffer);
var resultCode = RCode.NoError;
var answers = new List<DNSAnswer>();
foreach(var query in dnsRequest.Queries)
{
DNSAnswerData? answerData = null;
switch (query.QType)
{
case QType.A:
answerData = new AAnswerData(System.Net.IPAddress.Parse("192.168.1.1"));
break;
case QType.AAAA:
answerData = new AAAAAnswerData(System.Net.IPAddress.Parse("2001:0db8:ac10:fe01::"));
break;
}
if (answerData == null)
{
continue;
}
answers.Add(new DNSAnswer(String.Join('.', query.Labels), answerData));
}
var dnsResponse = new DNSResponse(dnsRequest, answers.ToArray(), resultCode);
await client.SendAsync(dnsResponse.Data, dnsResponse.Data.Length, request.RemoteEndPoint);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
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-alpha | 225 | 1/5/2022 |