From 064b916b1a7631edf973424022dcae4a5eb10557 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 25 Jul 2021 15:21:51 -0700 Subject: [PATCH] net/dns/resolver: fix func used as netaddr.IP in printf Signed-off-by: Brad Fitzpatrick --- net/dns/resolver/forwarder.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/net/dns/resolver/forwarder.go b/net/dns/resolver/forwarder.go index 2069af95c..b690285ba 100644 --- a/net/dns/resolver/forwarder.go +++ b/net/dns/resolver/forwarder.go @@ -322,16 +322,18 @@ func (f *forwarder) sendDoH(ctx context.Context, urlBase string, c *http.Client, // iOS and we want the number of pending DNS lookups to be bursty // without too much associated goroutine/memory cost. func (f *forwarder) send(ctx context.Context, txidOut txid, closeOnCtxDone *closePool, packet []byte, dst netaddr.IPPort) ([]byte, error) { + ip := dst.IP() + // Upgrade known DNS IPs to DoH (DNS-over-HTTPs). - if urlBase, dc, ok := f.getDoHClient(dst.IP()); ok { + if urlBase, dc, ok := f.getDoHClient(ip); ok { res, err := f.sendDoH(ctx, urlBase, dc, packet) if err == nil || ctx.Err() != nil { return res, err } - f.logf("DoH error from %v: %v", dst.IP, err) + f.logf("DoH error from %v: %v", ip, err) } - ln, err := f.packetListener(dst.IP()) + ln, err := f.packetListener(ip) if err != nil { return nil, err }