From 946c480bd4f19fc249303d439e994765476cb124 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Mon, 31 Mar 2025 12:08:10 +0000 Subject: [PATCH] Update sockopt_darwin.go --- transport/internet/sockopt_darwin.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/transport/internet/sockopt_darwin.go b/transport/internet/sockopt_darwin.go index 79e2133a..95900128 100644 --- a/transport/internet/sockopt_darwin.go +++ b/transport/internet/sockopt_darwin.go @@ -182,6 +182,12 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig) } } + if config.V6Only { + if err := unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_V6ONLY, 1); err != nil { + return errors.New("failed to set IPV6_V6ONLY").Base(err) + } + } + return nil }