From 6fedd7ec844e58a5cc95f4146134cccdf45201bc Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Mon, 4 Jan 2021 00:51:53 +0800 Subject: [PATCH] Fix: dns client should not bind local address --- dns/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dns/client.go b/dns/client.go index a40888dddf..151bee24a0 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"