{"record":{"id":"d26f216e4947e95a","repo":"txthinking/brook","slug":"no-address","errorCode":null,"errorMessage":"no address","messagePattern":"no address","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dohclient.go","lineNumber":40,"sourceCode":"\t\"net/http\"\n\t\"net/url\"\n\n\t\"github.com/miekg/dns\"\n)\n\ntype DOHClient struct {\n\tClient *http.Client\n\tDOH    string\n}\n\nfunc NewDOHClient(doh string) (*DOHClient, error) {\n\tu, err := url.Parse(doh)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta := u.Query().Get(\"address\")\n\tif a == \"\" {\n\t\treturn nil, errors.New(\"no address\")\n\t}\n\tq := u.Query()\n\tq.Del(\"address\")\n\tu.RawQuery = q.Encode()\n\tc := &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tDial: func(network, addr string) (net.Conn, error) {\n\t\t\t\treturn DialTCP(\"tcp\", \"\", a)\n\t\t\t},\n\t\t},\n\t}\n\treturn &DOHClient{\n\t\tClient: c,\n\t\tDOH:    u.String(),\n\t}, nil\n}\n\nfunc (c *DOHClient) Exchange(m *dns.Msg) (*dns.Msg, error) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/txthinking/brook/blob/5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8/dohclient.go#L22-L58","documentation":"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.","triggerScenarios":"Thrown at dohclient.go:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include an address query parameter, e.g. https://dns.example.com/dns-query?address=1.2.3.4:443","Verify the URL was not rewritten and the parameter name is exactly 'address'"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8","analyzedAt":"2026-09-06T04:35:00.432Z","contentChangedAt":"2026-09-06T04:35:00.432Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}