mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-21 07:27:32 +00:00
27 lines
512 B
Go
27 lines
512 B
Go
// +build linux netbsd freebsd openbsd dragonflybsd
|
|
|
|
package multicast
|
|
|
|
import "syscall"
|
|
import "golang.org/x/sys/unix"
|
|
|
|
func (m *Multicast) multicastStarted() {
|
|
|
|
}
|
|
|
|
func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {
|
|
var control error
|
|
var reuseport error
|
|
|
|
control = c.Control(func(fd uintptr) {
|
|
reuseport = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
|
|
})
|
|
|
|
switch {
|
|
case reuseport != nil:
|
|
return reuseport
|
|
default:
|
|
return control
|
|
}
|
|
}
|