diff --git a/dns/client.go b/dns/client.go index a40888dd..151bee24 100644 --- a/dns/client.go +++ b/dns/client.go @@ -39,7 +39,7 @@ func (c *client) ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err return nil, err } - if dialer.DialHook != nil { + if ip != nil && ip.IsGlobalUnicast() && dialer.DialHook != nil { network := "udp" if strings.HasPrefix(c.Client.Net, "tcp") { network = "tcp"