MCPcopy Index your code
hub / github.com/domainr/dnsr

github.com/domainr/dnsr @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
107 symbols 410 edges 13 files 37 documented · 35% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

ContextDialer (Interface)
A ContextDialer implements the DialContext method, e.g. net.Dialer.
resolver.go
Option (FuncType)
Option specifies a configuration option for a Resolver.
resolver.go

Core symbols most depended-on inside this repo

NewResolver
called by 39
resolver.go
ResolveErr
called by 35
resolver.go
toLowerFQDN
called by 16
strings.go
String
called by 10
rr.go
get
called by 9
cache.go
newCache
called by 8
cache.go
add
called by 8
cache.go
addNX
called by 7
cache.go

Shape

Function 80
Method 20
Struct 3
TypeAlias 2
FuncType 1
Interface 1

Languages

Go100%

Modules by API surface

resolver_test.go43 symbols
resolver.go25 symbols
cache.go10 symbols
logging.go7 symbols
rr.go6 symbols
cache_test.go6 symbols
cmd/dnsr/main.go4 symbols
strings.go2 symbols
rr_test.go2 symbols
strings_test.go1 symbols
root.go1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add dnsr \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact