udp_windows.go 671 B

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