MCPcopy Index your code
hub / github.com/tailscale/tailscale / CallbackRouter

Struct CallbackRouter

wgengine/router/callback.go:16–37  ·  view source on GitHub ↗

CallbackRouter is an implementation of both Router and dns.OSConfigurator. When either network or DNS settings are changed, SetBoth is called with both configs. Mainly used as a shim for OSes that want to set both network and DNS configuration simultaneously (Mac, iOS, Android).

Source from the content-addressed store, hash-verified

14// Mainly used as a shim for OSes that want to set both network and
15// DNS configuration simultaneously (Mac, iOS, Android).
16type CallbackRouter struct {
17 SetBoth func(rcfg *Config, dcfg *dns.OSConfig) error
18 SplitDNS bool
19
20 // GetBaseConfigFunc optionally specifies a function to return the current DNS
21 // config in response to GetBaseConfig.
22 //
23 // If nil, reading the current config isn't supported and GetBaseConfig()
24 // will return ErrGetBaseConfigNotSupported.
25 GetBaseConfigFunc func() (dns.OSConfig, error)
26
27 // InitialMTU is the MTU the tun should be initialized with.
28 // Zero means don't change the MTU from the default. This MTU
29 // is applied only once, shortly after the TUN is created, and
30 // ignored thereafter.
31 InitialMTU uint32
32
33 mu sync.Mutex // protects all the following
34 didSetMTU bool // if we set the MTU already
35 rcfg *Config // last applied router config
36 dcfg *dns.OSConfig // last applied DNS config
37}
38
39// Up implements Router.
40func (r *CallbackRouter) Up() error {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected