doh-go

module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT

README

Release Go version Tantalor93 lint codecov Go Report Card

doh-go

DoH client written in Golang with minimal dependencies, built on top of https://github.com/miekg/dns and standard http client (net/http) and based on DoH RFC

Usage in your project

add dependency

go get github.com/tantalor93/doh-go

Examples

// create client with default settings resolving via CloudFlare DoH Server
c := doh.NewClient("https://1.1.1.1/dns-query")

// prepare payload
msg := dns.Msg{}
msg.SetQuestion("google.com.", dns.TypeA)

// send DNS query using HTTP POST method
r, err := c.SendViaPost(context.Background(), &msg)
if err != nil {
    panic(err)
}

// do something with response
fmt.Println(dns.RcodeToString[r.Rcode])

// send DNS query using HTTP GET method
r, err = c.SendViaGet(context.Background(), &msg)
if err != nil {
    panic(err)
}

// do something with response
fmt.Println(dns.RcodeToString[r.Rcode])

Directories

Path Synopsis
Package doh provides API for calling DoH servers.
Package doh provides API for calling DoH servers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL