Skip to content

Commit 6515b64

Browse files
committed
tweak it
1 parent 5f62ccd commit 6515b64

8 files changed

Lines changed: 91 additions & 294 deletions

File tree

examples/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ listen:
151151
# office to home) leaves Nebula sending out an interface that no longer has a route. When true, Nebula watches
152152
# the routing socket and rebinds the listener once the change settles.
153153
# iOS does not use this, the host app drives the same rebind itself.
154-
# Default true. This setting is reloadable.
154+
# Default true. Not reloadable.
155155
#rebind_on_network_change: true
156156

157157
# By default, Nebula replies to packets it has no tunnel for with a "recv_error" packet. This packet helps speed up reconnection

main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ func Main(c *config.C, configTest bool, buildVersion string, l *slog.Logger, dev
268268

269269
attachCommands(l, c, ssh, ifce)
270270

271-
networkChanges := newNetworkChangeMonitorFromConfig(ctx, l, c)
272-
273271
control := &Control{
274272
state: StateReady,
275273
f: ifce,
@@ -280,13 +278,13 @@ func Main(c *config.C, configTest bool, buildVersion string, l *slog.Logger, dev
280278
statsStart: stats.Start,
281279
dnsStart: ds.Start,
282280
lighthouseStart: lightHouse.StartUpdateWorker,
283-
networkChangeStart: networkChanges.Start,
284281
connectionManagerStart: connManager.Start,
285282
}
286283

287284
// The monitor's whole job is to trigger a rebind, and Control is what owns rebinding and the state gating
288-
// around it, so this can only be wired once Control exists.
289-
networkChanges.setRebind(control.RebindUDPServer)
285+
// around it, so it is injected the rebind func and can only be built once Control exists.
286+
networkChanges := udp.NewNetworkChangeMonitor(ctx, l, c, control.RebindUDPServer)
287+
control.networkChangeStart = networkChanges.Start
290288

291289
return control, nil
292290
}

network_change.go

Lines changed: 0 additions & 145 deletions
This file was deleted.

network_change_test.go

Lines changed: 0 additions & 137 deletions
This file was deleted.

udp/netchange_darwin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const (
2525
netChangeReadBuffer = 4096
2626
)
2727

28-
// WatchNetworkChanges reports when the local network moves out from under us, so the listener can be rebound.
28+
// watchNetworkChanges reports when the local network moves out from under us, so the listener can be rebound.
2929
//
3030
// Darwin scopes a udp socket to whatever interface it came up on. Move between networks and we keep sending out an
3131
// interface that no longer has a route, which surfaces as an instant "no route to host" with no packet ever leaving
@@ -35,7 +35,7 @@ const (
3535
// The returned channel is buffered and coalescing: a send is dropped if one is already pending, since both mean the
3636
// same thing to a reader. It is closed when ctx is cancelled or the routing socket fails, so a caller can simply
3737
// range over it. Platforms whose sockets do not need rebinding return a nil channel and no error.
38-
func WatchNetworkChanges(ctx context.Context, l *slog.Logger) (<-chan struct{}, error) {
38+
func watchNetworkChanges(ctx context.Context, l *slog.Logger) (<-chan struct{}, error) {
3939
sock, err := openRouteSocket()
4040
if err != nil {
4141
return nil, err

0 commit comments

Comments
 (0)