mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-24 01:26:39 +00:00
feature/featuretags, all: add build features, use existing ones in more places
Saves 270 KB. Updates #12614 Change-Id: I4c3fe06d32c49edb3a4bb0758a8617d83f291cf5 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
aa5b2ce83b
commit
c45f8813b4
@@ -16,6 +16,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"tailscale.com/feature/buildfeatures"
|
||||
"tailscale.com/syncs"
|
||||
"tailscale.com/types/lazy"
|
||||
)
|
||||
@@ -51,6 +52,9 @@ const (
|
||||
// ResolverIP returns the cloud host's recursive DNS server or the
|
||||
// empty string if not available.
|
||||
func (c Cloud) ResolverIP() string {
|
||||
if !buildfeatures.HasCloud {
|
||||
return ""
|
||||
}
|
||||
switch c {
|
||||
case GCP:
|
||||
return GoogleMetadataAndDNSIP
|
||||
@@ -92,6 +96,9 @@ var cloudAtomic syncs.AtomicValue[Cloud]
|
||||
|
||||
// Get returns the current cloud, or the empty string if unknown.
|
||||
func Get() Cloud {
|
||||
if !buildfeatures.HasCloud {
|
||||
return ""
|
||||
}
|
||||
if c, ok := cloudAtomic.LoadOk(); ok {
|
||||
return c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user