ipn/ipnlocal: use buildfeature consts in a few more places

Updates #12614

Change-Id: I561d434d9829172a3d7f6933399237924ff80490
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/17445/head
Brad Fitzpatrick 2 months ago committed by Brad Fitzpatrick
parent 223ced84b5
commit db65f3fcf8

@ -5416,7 +5416,9 @@ func (b *LocalBackend) applyPrefsToHostinfoLocked(hi *tailcfg.Hostinfo, prefs ip
hi.ShieldsUp = prefs.ShieldsUp() hi.ShieldsUp = prefs.ShieldsUp()
hi.AllowsUpdate = buildfeatures.HasClientUpdate && (envknob.AllowsRemoteUpdate() || prefs.AutoUpdate().Apply.EqualBool(true)) hi.AllowsUpdate = buildfeatures.HasClientUpdate && (envknob.AllowsRemoteUpdate() || prefs.AutoUpdate().Apply.EqualBool(true))
b.metrics.advertisedRoutes.Set(float64(tsaddr.WithoutExitRoute(prefs.AdvertiseRoutes()).Len())) if buildfeatures.HasAdvertiseRoutes {
b.metrics.advertisedRoutes.Set(float64(tsaddr.WithoutExitRoute(prefs.AdvertiseRoutes()).Len()))
}
var sshHostKeys []string var sshHostKeys []string
if buildfeatures.HasSSH && prefs.RunSSH() && envknob.CanSSHD() { if buildfeatures.HasSSH && prefs.RunSSH() && envknob.CanSSHD() {
@ -5445,7 +5447,10 @@ func (b *LocalBackend) applyPrefsToHostinfoLocked(hi *tailcfg.Hostinfo, prefs ip
// DNS records are needed, so we can save bandwidth and not send // DNS records are needed, so we can save bandwidth and not send
// WireIngress. // WireIngress.
hi.WireIngress = b.shouldWireInactiveIngressLocked() hi.WireIngress = b.shouldWireInactiveIngressLocked()
hi.AppConnector.Set(prefs.AppConnector().Advertise)
if buildfeatures.HasAppConnectors {
hi.AppConnector.Set(prefs.AppConnector().Advertise)
}
// The [tailcfg.Hostinfo.ExitNodeID] field tells control which exit node // The [tailcfg.Hostinfo.ExitNodeID] field tells control which exit node
// was selected, if any. // was selected, if any.
@ -5461,8 +5466,10 @@ func (b *LocalBackend) applyPrefsToHostinfoLocked(hi *tailcfg.Hostinfo, prefs ip
// ExitNodeID here; [LocalBackend.ResolveExitNode] will be called once // ExitNodeID here; [LocalBackend.ResolveExitNode] will be called once
// the netmap and/or net report have been received to both pick the exit // the netmap and/or net report have been received to both pick the exit
// node and notify control of the change. // node and notify control of the change.
if sid := prefs.ExitNodeID(); sid != unresolvedExitNodeID { if buildfeatures.HasUseExitNode {
hi.ExitNodeID = prefs.ExitNodeID() if sid := prefs.ExitNodeID(); sid != unresolvedExitNodeID {
hi.ExitNodeID = prefs.ExitNodeID()
}
} }
} }

@ -20,6 +20,7 @@ import (
"strings" "strings"
"time" "time"
"tailscale.com/feature/buildfeatures"
"tailscale.com/types/dnstype" "tailscale.com/types/dnstype"
"tailscale.com/types/key" "tailscale.com/types/key"
"tailscale.com/types/opt" "tailscale.com/types/opt"
@ -1088,6 +1089,9 @@ func (ni *NetInfo) String() string {
} }
func (ni *NetInfo) portMapSummary() string { func (ni *NetInfo) portMapSummary() string {
if !buildfeatures.HasPortMapper {
return "x"
}
if !ni.HavePortMap && ni.UPnP == "" && ni.PMP == "" && ni.PCP == "" { if !ni.HavePortMap && ni.UPnP == "" && ni.PMP == "" && ni.PCP == "" {
return "?" return "?"
} }

Loading…
Cancel
Save