1
0
Fork 0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-04-05 23:03:34 +03:00

Sockopt: Add Windows V6Only

This commit is contained in:
xqzr 2025-03-31 05:43:22 +08:00 committed by GitHub
parent 52a2c63682
commit 5842bbc9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,7 @@ const (
IPV6_UNICAST_IF = 31
IP_MULTICAST_IF = 9
IPV6_MULTICAST_IF = 9
IPV6_V6ONLY = 27
)
func setTFO(fd syscall.Handle, tfo int) error {
@ -89,6 +90,11 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
}
}
}
if config.V6Only {
if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.IPPROTO_IPV6, IPV6_V6ONLY, 1); err != nil {
return errors.New("failed to set IPV6_V6ONLY").Base(err)
}
}
return nil
}