@ -81,6 +81,15 @@ type Knobs struct {
// how to dial the destination address. When true, it also makes the DNS forwarder
// how to dial the destination address. When true, it also makes the DNS forwarder
// use UserDial instead of SystemDial when dialing resolvers.
// use UserDial instead of SystemDial when dialing resolvers.
UserDialUseRoutes atomic . Bool
UserDialUseRoutes atomic . Bool
// DisableSplitDNSWhenNoCustomResolvers indicates that the node's DNS manager
// should not adopt a split DNS configuration even though the Config of the
// resolver only contains routes that do not specify custom resolver(s), hence
// all DNS queries can be safely sent to the upstream DNS resolver and the
// node's DNS forwarder doesn't need to handle all DNS traffic.
// This is for now (2024-06-06) an iOS-specific battery life optimization,
// and this knob allows us to disable the optimization remotely if needed.
DisableSplitDNSWhenNoCustomResolvers atomic . Bool
}
}
// UpdateFromNodeAttributes updates k (if non-nil) based on the provided self
// UpdateFromNodeAttributes updates k (if non-nil) based on the provided self
@ -107,6 +116,7 @@ func (k *Knobs) UpdateFromNodeAttributes(capMap tailcfg.NodeCapMap) {
probeUDPLifetime = has ( tailcfg . NodeAttrProbeUDPLifetime )
probeUDPLifetime = has ( tailcfg . NodeAttrProbeUDPLifetime )
appCStoreRoutes = has ( tailcfg . NodeAttrStoreAppCRoutes )
appCStoreRoutes = has ( tailcfg . NodeAttrStoreAppCRoutes )
userDialUseRoutes = has ( tailcfg . NodeAttrUserDialUseRoutes )
userDialUseRoutes = has ( tailcfg . NodeAttrUserDialUseRoutes )
disableSplitDNSWhenNoCustomResolvers = has ( tailcfg . NodeAttrDisableSplitDNSWhenNoCustomResolvers )
)
)
if has ( tailcfg . NodeAttrOneCGNATEnable ) {
if has ( tailcfg . NodeAttrOneCGNATEnable ) {
@ -131,6 +141,7 @@ func (k *Knobs) UpdateFromNodeAttributes(capMap tailcfg.NodeCapMap) {
k . ProbeUDPLifetime . Store ( probeUDPLifetime )
k . ProbeUDPLifetime . Store ( probeUDPLifetime )
k . AppCStoreRoutes . Store ( appCStoreRoutes )
k . AppCStoreRoutes . Store ( appCStoreRoutes )
k . UserDialUseRoutes . Store ( userDialUseRoutes )
k . UserDialUseRoutes . Store ( userDialUseRoutes )
k . DisableSplitDNSWhenNoCustomResolvers . Store ( disableSplitDNSWhenNoCustomResolvers )
}
}
// AsDebugJSON returns k as something that can be marshalled with json.Marshal
// AsDebugJSON returns k as something that can be marshalled with json.Marshal
@ -156,5 +167,6 @@ func (k *Knobs) AsDebugJSON() map[string]any {
"ProbeUDPLifetime" : k . ProbeUDPLifetime . Load ( ) ,
"ProbeUDPLifetime" : k . ProbeUDPLifetime . Load ( ) ,
"AppCStoreRoutes" : k . AppCStoreRoutes . Load ( ) ,
"AppCStoreRoutes" : k . AppCStoreRoutes . Load ( ) ,
"UserDialUseRoutes" : k . UserDialUseRoutes . Load ( ) ,
"UserDialUseRoutes" : k . UserDialUseRoutes . Load ( ) ,
"DisableSplitDNSWhenNoCustomResolvers" : k . DisableSplitDNSWhenNoCustomResolvers . Load ( ) ,
}
}
}
}