From f7d41a2cab511544a8291ebfb5ac3b931602b1cf Mon Sep 17 00:00:00 2001 From: Suzukihonoka Date: Fri, 20 Dec 2024 15:51:14 +0800 Subject: [PATCH] feat: support Linux abstract namespace --- proxy/socks5.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/proxy/socks5.go b/proxy/socks5.go index bdc9b04c..19dd4ea7 100644 --- a/proxy/socks5.go +++ b/proxy/socks5.go @@ -26,6 +26,13 @@ type Socks5 struct { } func NewSocks5(addr, user, pass string) (*Socks5, error) { + unix := len(addr) > 0 && addr[0] == '/' + + // For support Linux abstract namespace + if len(addr) > 2 && addr[1] == '@' || addr[1] == 0x00 { + addr = addr[1:] + } + return &Socks5{ Base: &Base{ addr: addr, @@ -33,7 +40,7 @@ func NewSocks5(addr, user, pass string) (*Socks5, error) { }, user: user, pass: pass, - unix: len(addr) > 0 && addr[0] == '/', + unix: unix, }, nil }