udp_windows.go 629 B

1234567891011121314151617181920212223242526
  1. package nebula
  2. // Windows support is primarily implemented in udp_generic, besides NewListenConfig
  3. import (
  4. "fmt"
  5. "net"
  6. "syscall"
  7. )
  8. func NewListenConfig(multi bool) net.ListenConfig {
  9. return net.ListenConfig{
  10. Control: func(network, address string, c syscall.RawConn) error {
  11. if multi {
  12. // There is no way to support multiple listeners safely on Windows:
  13. // https://docs.microsoft.com/en-us/windows/desktop/winsock/using-so-reuseaddr-and-so-exclusiveaddruse
  14. return fmt.Errorf("multiple udp listeners not supported on windows")
  15. }
  16. return nil
  17. },
  18. }
  19. }
  20. func (u *udpConn) Rebind() error {
  21. return nil
  22. }