From 93d2cfa0918e27b28a00496c57d38575a29a2f1a Mon Sep 17 00:00:00 2001 From: fishg <1423545+fishg@users.noreply.github.com> Date: Mon, 4 Apr 2022 10:39:26 +0800 Subject: [PATCH] fix: when ssh connect to a ip, if this ip map to a domain in clash, change ip to host may redirect to a diffrent ip --- constant/metadata.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/constant/metadata.go b/constant/metadata.go index f63816b1..3da67201 100644 --- a/constant/metadata.go +++ b/constant/metadata.go @@ -83,7 +83,11 @@ type Metadata struct { } func (m *Metadata) RemoteAddress() string { - return net.JoinHostPort(m.String(), m.DstPort) + if m.DstIP != nil { + return net.JoinHostPort(m.DstIP.String(), m.DstPort) + } else { + return net.JoinHostPort(m.String(), m.DstPort) + } } func (m *Metadata) SourceAddress() string {