Giter VIP home page Giter VIP logo

dinodns's Introduction

Icon

Dino DNS

A fast and efficient DNS server and client

Build NuGet

Overview

Dino DNS provides fast and flexible DNS client and server implementations for:

๐Ÿค Licensing and Support

Dino DNS is licensed under the MIT license. It is free to use in personal and commercial projects.

There are support plans available that cover all active Turner Software OSS projects. Support plans provide private email support, expert usage advice for our projects, priority bug fixes and more. These support plans help fund our OSS commitments to provide better software for everyone.

๐Ÿฅ‡ Performance

These performance comparisons show the performance overhead of the DNS library itself and associated allocations. They do not represent the network overhead to a remote DNS servers.

The server implementation that each benchmark is performing against is Dino DNS.

DNS-over-UDP

This is your typical DNS query. While fast and efficient, it is limited by the lack of transport-layer encryption, reliable delivery and message length.

Method Mean Error StdDev Op/s Ratio RatioSD Gen 0 Gen 1 Allocated
DinoDNS 90.28 us 1.066 us 0.945 us 11,077.1 1.00 0.00 0.4883 - 1,704 B
Kapetan_DNS 325.99 us 10.447 us 30.803 us 3,067.6 3.58 0.19 23.4375 0.9766 73,996 B
MichaCo_DnsClient 257.72 us 5.141 us 10.384 us 3,880.1 2.84 0.11 22.4609 - 71,640 B

DNS-over-TCP

With TCP DNS queries, there is a small overhead from negotiating the connection but otherwise is very fast. It addresses the reliable delivery and message length limitations that occur with UDP queries.

A good DNS client implementation will pool TCP sockets to avoid needing to negotiate the connection per request.

Method Mean Error StdDev Op/s Ratio RatioSD Gen 0 Allocated
DinoDNS 94.99 us 1.018 us 0.902 us 10,527.1 1.00 0.00 0.4883 1,892 B
MichaCo_DnsClient 112.52 us 2.246 us 3.562 us 8,887.1 1.21 0.05 1.4648 5,064 B
โš  Note: While Kapetan's DNS client does support TCP, it can't be benchmarked due to port exhaustion issues it has.

DNS-over-TLS

With DNS-over-TLS, you get the benefits of DNS-over-TCP with transport-layer encryption between the client and the server.

Method Mean Error StdDev Op/s Ratio Gen 0 Allocated
DinoDNS 126.5 us 2.09 us 1.95 us 7,908.1 1.00 0.4883 2,274 B

๐Ÿ‘‹ Know of a .NET DNS-over-TLS client? Raise a PR to add it as a comparison!

DNS-over-HTTPS

An alternative to DNS-over-TLS is DNS-over-HTTPS, providing the same core functionality through a different method. This can disguise DNS traffic when performed over port 443 (the default port for HTTPS).

Method Mean Error StdDev Op/s Ratio Gen 0 Allocated
DinoDNS 207.2 us 3.77 us 3.52 us 4,827.1 1.00 1.4648 5,625 B

๐Ÿ‘‹ Know of a .NET DNS-over-HTTPS client? Raise a PR to add it as a comparison!

โญ Getting Started

Perform a DNS query

This is a basic query against a DNS server, retrieving "A" records to further process.

var client = new DnsClient(new NameServer[]
{
	new NameServer(IPAddress.Parse("192.168.0.1"), ConnectionType.Udp)
	NameServers.Cloudflare.IPv4.GetPrimary(ConnectionType.DoH),
}, DnsMessageOptions.Default);

var dnsMessage = await client.QueryAsync("example.org", DnsQueryType.A);
var aRecords = dnsMessage.Answers.WithARecords();

Implement a basic DNS server

This is a basic forwarding DNS server where you can, for example, have use a UDP server endpoint but forward over TLS to another name server.

public class DnsForwardingServer : DnsServerBase
{
	private readonly DnsClient Client;

	public DnsForwardingServer(
		NameServer[] nameServers,
		ServerEndPoint[] endPoints,
		DnsMessageOptions options
	) : base(endPoints, options)
	{
		Client = new DnsClient(nameServers, options);
	}

	protected override async ValueTask<int> OnReceiveAsync(ReadOnlyMemory<byte> requestBuffer, Memory<byte> responseBuffer, CancellationToken cancellationToken)
	{
		return await Client.SendAsync(requestBuffer, responseBuffer, cancellationToken).ConfigureAwait(false);
	}
}

var server = new DnsForwardingServer(
	new[] { NameServers.Cloudflare.IPv4.GetPrimary(ConnectionType.DoT) },
	new[] { new ServerEndpoint(ConnectionType.Udp) },
	DnsMessageOptions.Default
);
server.Start();

dinodns's People

Contributors

dependabot[bot] avatar turnerj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dinodns's Issues

Need a document about DinoDNS

I'm trying to use DinoDNS. A document would make it much easier. Is there a document introducing the classes & functions in DinoDNS?

Extended options/configuration for DoH and DoT

This issue has two parts with the general theme being extended options/configuration support.


Currently the path is hard coded to "/dns-query". While this works for Google, Cloudflare and is mentioned in the DNS-over-HTTPS RFC, not all DoH servers may use that. As long as they correspond to POST requests still, the HTTPS resolver should still be able to communicate with them if the path was set to what they use.

Current thought is a custom static method to create an instance of NameServer with options for HTTPS resolvers:

NameServer.CreateHttps(IPEndPoint, HttpsResolverOptions);

Examples of DoH servers that don't as raised to me via email (I do not know nor endorse these, they purely serve as an example of alternative DoH paths in the wild):

https://doh.applied-privacy.net/query
https://doh.cleanbrowsing.org/doh/security-filter
https://doh.cleanbrowsing.org/doh/adult-filter

Currently DNS-over-TLS doesn't allow you to easily specify the DNS host name for the resolver in terms of validating the certificate. Similar to the above with HTTPS options, a more functional way to modify options for a TLS connection would be nicer than creating a custom resolver manually.

Related #19


For the case of general nested resolving, both of these could be extended to have an async variant that allows resolving of a DNS server which would create the NameServer instance. This would need to create a one-off DNS client to somewhere to resolve it and will need to be provided a name server to connect to.

For example, something like this:

NameServer.CreateHttpsAsync(Uri httpsDnsServer, NameServer resolvedVia, HttpsResolverOptions); 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.