Sockopt: Allow listen v6only work for Windows & Darwin (#4571)

Completes https://github.com/XTLS/Xray-core/pull/1677

---------

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
xqzr 2025-03-31 20:13:57 +08:00 committed by RPRX
parent 63eb0539b3
commit 2abeda9c42
2 changed files with 13 additions and 0 deletions

View file

@ -200,6 +200,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
}