txthinking/brook · error

no address

Error message

no address

What it means

Constructor validation in NewDOHClient: the DOH URL parsed, but its query string has no 'address' parameter, so the client has nothing to dial the DoH endpoint through (the address parameter is used as the dial target and is stripped from the URL afterwards). The input at fault is a DoH URL missing ?address=host:port.

Source

Thrown at dohclient.go:40

	"net/http"
	"net/url"

	"github.com/miekg/dns"
)

type DOHClient struct {
	Client *http.Client
	DOH    string
}

func NewDOHClient(doh string) (*DOHClient, error) {
	u, err := url.Parse(doh)
	if err != nil {
		return nil, err
	}
	a := u.Query().Get("address")
	if a == "" {
		return nil, errors.New("no address")
	}
	q := u.Query()
	q.Del("address")
	u.RawQuery = q.Encode()
	c := &http.Client{
		Transport: &http.Transport{
			Dial: func(network, addr string) (net.Conn, error) {
				return DialTCP("tcp", "", a)
			},
		},
	}
	return &DOHClient{
		Client: c,
		DOH:    u.String(),
	}, nil
}

func (c *DOHClient) Exchange(m *dns.Msg) (*dns.Msg, error) {

View on GitHub (pinned to 5cd13ef3b1)

Solutions

  1. Include an address query parameter, e.g. https://dns.example.com/dns-query?address=1.2.3.4:443
  2. Verify the URL was not rewritten and the parameter name is exactly 'address'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dohclient.go:40 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of txthinking/brook@5cd13ef3b1 (2026-09-06). Data as JSON: /api/errors/d26f216e4947e95a. Report an issue: GitHub.