Break out multicast into a separate package

This commit is contained in:
Neil Alexander 2019-03-28 16:13:14 +00:00
parent 03bc7bbcd6
commit 7ea4e9575e
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
10 changed files with 103 additions and 71 deletions

View file

@ -0,0 +1,26 @@
// +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
}
}