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