2
0

udp_windows.go 653 B

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