tailscale.comtailscale.com/util/cloudenv Index | Files

package cloudenv

import "tailscale.com/util/cloudenv"

Package cloudenv reports which known cloud environment we're running in.

Index

Constants

const (
	AWS          = Cloud("aws")          // Amazon Web Services (EC2 in particular)
	Azure        = Cloud("azure")        // Microsoft Azure
	GCP          = Cloud("gcp")          // Google Cloud
	DigitalOcean = Cloud("digitalocean") // DigitalOcean
)
const AWSResolverIP = "169.254.169.253"

AWSResolverIP is the IP address of the AWS DNS server. See https://docs.aws.amazon.com/vpc/latest/userguide/vpc-dns.html

const AzureResolverIP = "168.63.129.16"

AzureResolverIP is Azure's DNS resolver IP. See https://docs.microsoft.com/en-us/azure/virtual-network/what-is-ip-address-168-63-129-16

const CommonNonRoutableMetadataIP = "169.254.169.254"

CommonNonRoutableMetadataIP is the IP address of the metadata server on Amazon EC2, Google Compute Engine, and Azure. It's not routable. (169.254.0.0/16 is a Link Local range: RFC 3927)

const GoogleMetadataAndDNSIP = "169.254.169.254"

GoogleMetadataAndDNSIP is the metadata IP used by Google Cloud. It's also the *.internal DNS server, and proxies to 8.8.8.8.

Types

type Cloud

type Cloud string

Cloud is a recognize cloud environment with properties that Tailscale can specialize for in places.

func Get

func Get() Cloud

Get returns the current cloud, or the empty string if unknown.

func (Cloud) HasInternalTLD

func (c Cloud) HasInternalTLD() bool

HasInternalTLD reports whether c is a cloud environment whose ResolverIP serves *.internal records.

func (Cloud) ResolverIP

func (c Cloud) ResolverIP() string

ResolverIP returns the cloud host's recursive DNS server or the empty string if not available.

Source Files

cloudenv.go

Version
v1.84.0 (latest)
Published
May 21, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
1 day ago

Tools for package owners.