From c6b7b951b9b98e04b8984c610b489ebf96dfdeaa Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Tue, 5 May 2020 12:39:25 +0800 Subject: [PATCH] Fix: use domain first on direct dial (#672) --- adapters/outbound/direct.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/adapters/outbound/direct.go b/adapters/outbound/direct.go index f9413e6e..9e896c3a 100644 --- a/adapters/outbound/direct.go +++ b/adapters/outbound/direct.go @@ -14,10 +14,7 @@ type Direct struct { } func (d *Direct) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) { - address := net.JoinHostPort(metadata.Host, metadata.DstPort) - if metadata.DstIP != nil { - address = net.JoinHostPort(metadata.DstIP.String(), metadata.DstPort) - } + address := net.JoinHostPort(metadata.String(), metadata.DstPort) c, err := dialer.DialContext(ctx, "tcp", address) if err != nil {