From 19fc70b2c4a89f24514992ef71122f26e07515a5 Mon Sep 17 00:00:00 2001 From: Skyxim Date: Sat, 23 Apr 2022 00:30:25 +0800 Subject: [PATCH] fix: general ipv6 is false should be broke ipv6 conn --- component/dialer/dialer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/component/dialer/dialer.go b/component/dialer/dialer.go index 663568ad..4f5d820e 100644 --- a/component/dialer/dialer.go +++ b/component/dialer/dialer.go @@ -3,6 +3,7 @@ package dialer import ( "context" "errors" + "fmt" "github.com/Dreamacro/clash/log" "net" "net/netip" @@ -107,6 +108,10 @@ func dialContext(ctx context.Context, network string, destination netip.Addr, po bindMarkToDialer(opt.routingMark, dialer, network, destination) } + if DisableIPv6 && destination.Is6() { + return nil, fmt.Errorf("IPv6 is diabled, dialer cancel") + } + return dialer.DialContext(ctx, network, net.JoinHostPort(destination.String(), port)) }