github.com/yggdrasil-network/yggdrasil-go@v0.5.6/src/multicast/multicast_windows.go (about)

     1  //go:build windows
     2  // +build windows
     3  
     4  package multicast
     5  
     6  import (
     7  	"syscall"
     8  
     9  	"golang.org/x/sys/windows"
    10  )
    11  
    12  func (m *Multicast) _multicastStarted() {
    13  
    14  }
    15  
    16  func (m *Multicast) multicastReuse(network string, address string, c syscall.RawConn) error {
    17  	var control error
    18  	var reuseaddr error
    19  
    20  	control = c.Control(func(fd uintptr) {
    21  		reuseaddr = windows.SetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
    22  	})
    23  
    24  	switch {
    25  	case reuseaddr != nil:
    26  		return reuseaddr
    27  	default:
    28  		return control
    29  	}
    30  }