Giter VIP home page Giter VIP logo

dnsclient.net's Introduction

slug title author lastModified pubDate categories
readme
Readme
Michael Conrad
2017-04-05 05:00:00 -0700
2017-03-26 05:00:00 -0700
DnsClient

DnsClient.NET

DnsClient.NET is a simple yet very powerful and high performant open source library for the .NET Framework to do DNS lookups.

Usage

See http://dnsclient.michaco.net for more details and documentation.

The following example instantiates a new LookupClient without specifying a DNS endpoint. DnsClient.NET will query your system network adapters to determine available DNS servers.

var lookup = new LookupClient();
var result = await lookup.QueryAsync("google.com", QueryType.ANY);

var record = result.Answers.ARecords().FirstOrDefault();
var address = record?.Address;

Builds

Build status

Get it via NuGet https://www.nuget.org/packages/DnsClient/

Get beta builds from MyGet.

Build from Code

Just clone the repository and open the solution in Visual Studio 2017. Or use the dotnet client via command line.

The unit tests don't require any additional setup right now.

If you want to test the different record types, there are config files for Bind under tools. Just download Bind for Windows and copy the binaries to tools/BIND, then run bind.cmd. If you are running this on Linux, you can use my config files and replace the default ones if you want.

Now, you can use samples/MiniDig to query the local DNS server. The following should return many different resource records:

dotnet run -s localhost micha.mcnet.com any

To test some random domain names, run MiniDig with the random sub command (works without setting up Bind, too).

dotnet run random -s localhost

Features

General

  • Full Async API
  • UDP and TCP lookup, configurable if TCP should be used as fallback in case UDP result is truncated (default=true).
  • Caching
    • Query result cache based on provided TTL
    • Minimum TTL setting to overrule the result's TTL and always cache the responses for at least that time. (Even very low value, like a few milliseconds, do make a huge difference if used in high traffic low latency scenarios)
    • Cache can be disabled altogether
  • Supports multiple DNS endpoints to be configured
  • Retry logic in case of timeouts and errors (configurable)
  • Audit trail of each response
  • Configurable error handling. Throwing DNS errors, like NotExistentDomain is turned off by default

Supported resource records

  • PTR for reverse lookups
  • A, AAAA, NS, CNAME, SOA, MB, MG, MR, WKS, HINFO, MINFO, MX, RP, TXT, AFSDB, SRV, URI, CAA
  • OPT (currently only for reading the supported UDP buffer size, EDNS version)

Examples

  • The Samples repository will have some solutions to showcase the usage and also to test some functionality.

  • MiniDig (See the readme over there)

Milestones

1.1 release

  • More testing
  • More RRs parsing

Motivation and Thanks!

Thanks to

for supporting me to test my websites and projects!

I used Heijden.Dns as a baseline for my first steps into the world of DNS RFCs. A big thanks to the original author of the code, Alphons van der Heijden and also Geoffrey Huntley who created a great package out of that. This was a great resource to learn from it and start building this API!

In the end, I decided to write my own API to make it easy to use, more robust, extensible and build on .NET Core for xplat support.

dnsclient.net's People

Contributors

mbp avatar michaco avatar rufusjwb avatar

Watchers

 avatar  avatar

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.