From 4f674755ce82f0399bc89c861df0ae5a3f5ce228 Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Thu, 11 Jun 2020 12:11:44 +0800 Subject: [PATCH] Fix: trim . for socks5 host --- adapters/inbound/util.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adapters/inbound/util.go b/adapters/inbound/util.go index a9901d0a..6241ac80 100644 --- a/adapters/inbound/util.go +++ b/adapters/inbound/util.go @@ -17,7 +17,8 @@ func parseSocksAddr(target socks5.Addr) *C.Metadata { switch target[0] { case socks5.AtypDomainName: - metadata.Host = string(target[2 : 2+target[1]]) + // trim for FQDN + metadata.Host = strings.TrimRight(string(target[2:2+target[1]]), ".") metadata.DstPort = strconv.Itoa((int(target[2+target[1]]) << 8) | int(target[2+target[1]+1])) case socks5.AtypIPv4: ip := net.IP(target[1 : 1+net.IPv4len])