Skip to content
/ dnsr Public

Iterative DNS resolver for Go (golang).

License

Notifications You must be signed in to change notification settings

domainr/dnsr

Folders and files

NameName
Last commit message
Last commit date
Mar 24, 2025
Feb 12, 2024
Oct 26, 2020
Nov 25, 2014
Nov 26, 2014
Jun 22, 2023
Sep 8, 2021
Oct 6, 2021
Feb 17, 2025
Feb 17, 2025
Nov 12, 2020
Mar 27, 2025
Apr 3, 2024
Apr 3, 2024
Oct 18, 2024
Jun 30, 2019
Jul 9, 2019
Jan 20, 2017
Aug 18, 2016

Repository files navigation

dnsr

build status go.dev reference

Iterative DNS resolver for Go.

The Resolve method on dnsr.Resolver queries DNS for given name and type (A, NS, CNAME, etc.). The resolver caches responses for queries, and liberally (aggressively?) returns DNS records for a given name, not waiting for slow or broken name servers.

This code leans heavily on Miek Gieben’s excellent DNS library, and is currently in production use at Domainr.

Install

go get github.com/domainr/dnsr

Usage

package main

import (
  "fmt"
  "github.com/domainr/dnsr"
)

func main() {
  r := dnsr.NewResolver(dnsr.WithCache(10000))
  for _, rr := range r.Resolve("google.com", "TXT") {
    fmt.Println(rr.String())
  }
}

Or construct with dnsr.NewResolver(dnsr.WithExpiry()) to expire cache entries based on TTL.

Documentation

Development

Run go generate in Go 1.4+ to refresh the root zone hint file. Pull requests welcome.

Copyright

© nb.io, LLC

About

Iterative DNS resolver for Go (golang).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages