1
0

netchange_generic.go 860 B

123456789101112131415161718192021
  1. //go:build !darwin || ios || e2e_testing
  2. package udp
  3. import (
  4. "context"
  5. "log/slog"
  6. )
  7. // watchNetworkChanges is a no-op outside of darwin.
  8. //
  9. // Darwin is the platform that scopes a udp socket to the interface it came up on, so it is the platform whose socket
  10. // goes stale when the local network changes. Everywhere else Rebind has nothing to do, so there is nothing to watch
  11. // for. iOS is excluded on purpose even though it is darwin: the host app already drives the rebind off NWPathMonitor,
  12. // and two things racing to rebind the same socket is worse than one.
  13. //
  14. // A nil channel means "not supported here", which callers must treat as "do not start a watcher" rather than
  15. // selecting on it, since a receive from a nil channel blocks forever.
  16. func watchNetworkChanges(_ context.Context, _ *slog.Logger) (<-chan struct{}, error) {
  17. return nil, nil
  18. }