mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-24 16:57:53 +00:00
23 lines
441 B
Go
23 lines
441 B
Go
|
// +build windows
|
||
|
|
||
|
package yggdrasil
|
||
|
|
||
|
import "syscall"
|
||
|
import "golang.org/x/sys/windows"
|
||
|
|
||
|
func multicastReuse(network string, address string, c syscall.RawConn) error {
|
||
|
var control error
|
||
|
var reuseaddr error
|
||
|
|
||
|
control = c.Control(func(fd uintptr) {
|
||
|
reuseaddr = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
|
||
|
})
|
||
|
|
||
|
switch {
|
||
|
case reuseaddr != nil:
|
||
|
return reuseaddr
|
||
|
default:
|
||
|
return control
|
||
|
}
|
||
|
}
|