Skip to content

Commit 1fc6e86

Browse files
committed
pkg/hostagent: Use Go's built-in DNS resolver in DialContextToGuestIP
Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
1 parent 377a259 commit 1fc6e86

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/hostagent/hostagent.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,13 @@ func (a *HostAgent) DialContextToGuestIP(guestIP net.IP) func(ctx context.Contex
999999
default:
10001000
return nil, fmt.Errorf("unsupported network %q", network)
10011001
}
1002-
d := net.Dialer{LocalAddr: sourceAddr}
1002+
d := net.Dialer{
1003+
LocalAddr: sourceAddr,
1004+
Resolver: &net.Resolver{
1005+
PreferGo: true,
1006+
StrictErrors: true,
1007+
},
1008+
}
10031009
_, port, err := net.SplitHostPort(address)
10041010
if err != nil {
10051011
return nil, err

0 commit comments

Comments
 (0)