Documentation
¶
Index ¶
- Constants
- Variables
- func AgentSubnetForRegion(region Region) string
- func FormatCloudIdentifier(cloudProvider CloudProvider, region, project string) string
- func GenerateHostname(ctx context.Context, host string, suffix string) (string, error)
- func GenerateHostnameWithCloudRegion(ctx context.Context, host string, suffix string, provider CloudProvider, ...) (string, error)
- func GenerateHostnamesForCloudRegions(ctx context.Context, host string, suffix string) ([]string, error)
- func GenerateNonOverlappingIPv4Subnet(existingNetworks []*net.IPNet, prefixLen int) (*net.IPNet, *net.IP, error)
- func GenerateServerIPv6FromIPv4(region Region, network Network, tenantID string, ipv4 net.IP) (net.IP, *net.IPNet, error)
- func GenerateSuperRegionHostname(ctx context.Context, host string, suffix string, region Region) (string, error)
- func GenerateSuperRegionHostnameFromCurrentCloud(ctx context.Context, host string, suffix string) (string, error)
- func GenerateSuperRegionHostnamesForAllRegions(ctx context.Context, host string, suffix string) ([]string, error)
- func GenerateUniqueIPv6() (net.IP, error)
- func GetCloudIdentifier(ctx context.Context) (string, error)
- func HadronSubnetForRegion(region Region) string
- func IsAgentuityIPv6Prefix(ip net.IP) bool
- func IsSuperRegion(val string) bool
- func IsSuperRegionLocal(val string) bool
- func SetCloudDetector(detector CloudDetector)
- type CloudDetector
- type CloudProvider
- type IPv6Address
- type Network
- type Region
- type SuperRegion
Constants ¶
const AetherServiceIP = "fd15:d710:2d:c580:9dc5:aeeb::"
AetherServiceIP is the IP address for the aether service
const AgentSubnetCENTRALUS = "fd15:d710:0140::/44"
AgentSubnetCENTRALUS is the subnet for the agent network in the centralus region
const AgentSubnetEASTUS = "fd15:d710:0340::/44"
AgentSubnetEASTUS is the subnet for the agent network in the eastus region
const AgentSubnetEASTUS2 = "fd15:d710:0840::/44"
AgentSubnetEASTUS2 is the subnet for the agent network in the eastus2 region
const AgentSubnetGLOBAL = "fd15:d710:0040::/44"
AgentSubnetGLOBAL is the subnet for the agent network in the global region
const AgentSubnetNORTHCENTRALUS = "fd15:d710:0440::/44"
AgentSubnetNORTHCENTRALUS is the subnet for the agent network in the northcentralus region
const AgentSubnetSOUTHCENTRALUS = "fd15:d710:0540::/44"
AgentSubnetSOUTHCENTRALUS is the subnet for the agent network in the southcentralus region
const AgentSubnetUSEast5 = "fd15:d710:0940::/44"
AgentSubnetUSEast5 is the subnet for the agent network in the us-east5 region
const AgentSubnetUSWest1 = "fd15:d710:0240::/44"
AgentSubnetUSWest1 is the subnet for the agent network in the us-west-1 region
const AgentSubnetUSWest2 = "fd15:d710:0640::/44"
AgentSubnetUSWest2 is the subnet for the agent network in the us-west-2 region
const AgentSubnetUSWest3 = "fd15:d710:0740::/44"
AgentSubnetUSWest3 is the subnet for the agent network in the us-west3 region
const AgentSubnetUSWest4 = "fd15:d710:0b40::/44"
AgentSubnetUSWest4 is the subnet for the agent network in the us-west4 region
const AgentuityIPV6ULAPrefix = "fd15:d710"
this is the agentuity IPV6 ULA prefix
const AgentuityTenantID = "agentuity"
const CatalystServiceIP = "fd15:d710:25:c500:9dc5:d408::"
CatalystServiceIP is the IP address for the catalyst service
const HadronSubnetCENTRALUS = "fd15:d710:0130::/44"
HadronSubnetCENTRALUS is the subnet for the hadron network in the centralus region
const HadronSubnetEASTUS = "fd15:d710:0330::/44"
HadronSubnetEASTUS is the subnet for the hadron network in the eastus region
const HadronSubnetEASTUS2 = "fd15:d710:0830::/44"
HadronSubnetEASTUS2 is the subnet for the hadron network in the eastus2 region
const HadronSubnetGLOBAL = "fd15:d710:0030::/44"
HadronSubnetGLOBAL is the subnet for the hadron network in the global region
const HadronSubnetNORTHCENTRALUS = "fd15:d710:0430::/44"
HadronSubnetNORTHCENTRALUS is the subnet for the hadron network in the northcentralus region
const HadronSubnetSOUTHCENTRALUS = "fd15:d710:0530::/44"
HadronSubnetSOUTHCENTRALUS is the subnet for the hadron network in the southcentralus region
const HadronSubnetUSEast5 = "fd15:d710:0930::/44"
HadronSubnetUSEast5 is the subnet for the hadron network in the us-east5 region
const HadronSubnetUSWest1 = "fd15:d710:0230::/44"
HadronSubnetUSWest1 is the subnet for the hadron network in the us-west-1 region
const HadronSubnetUSWest2 = "fd15:d710:0630::/44"
HadronSubnetUSWest2 is the subnet for the hadron network in the us-west-2 region
const HadronSubnetUSWest3 = "fd15:d710:0730::/44"
HadronSubnetUSWest3 is the subnet for the hadron network in the us-west3 region
const HadronSubnetUSWest4 = "fd15:d710:0b30::/44"
HadronSubnetUSWest4 is the subnet for the hadron network in the us-west4 region
const InternalServiceSubnet = "fd15:d710:0020::/44"
InternalServiceSubnet is the subnet for the internal service network
const IonServiceIP = "fd15:d710:2c:8380:9dc5:95eb::"
IonServiceIP is the IP address for the ion service
const OtelServiceIP = "fd15:d710:2a:68d0:9dc5:2763::"
OtelServiceIP is the IP address for the otel service
const RegistryServiceIP = "fd15:d710:2b:6d30:9dc5:e069::"
RegistryServiceIP is the IP address for the registry service
const StreamsServiceIP = "fd15:d710:29:9440:9dc5:96bf::"
StreamsServiceIP is the IP address for the streams service
Variables ¶
var Addresses = map[string]net.IP{ "aether": net.ParseIP(AetherServiceIP), "catalyst": net.ParseIP(CatalystServiceIP), "otel": net.ParseIP(OtelServiceIP), "registry": net.ParseIP(RegistryServiceIP), "streams": net.ParseIP(StreamsServiceIP), "ion": net.ParseIP(IonServiceIP), }
Addresses is a map of service names to their IP addresses
var ProductionRegions = map[CloudProvider][]Region{ CloudProviderAWS: { RegionUSCentral1, }, CloudProviderGCP: { RegionUSCentral1, RegionUSEast1, }, CloudProviderAzure: { RegionUSCentral1, }, }
ProductionRegions returns a map of the production regions for each cloud provider currently supported.
var RegionToSuperRegion = map[Region]SuperRegion{ RegionUSCentral1: SuperRegionUSCentral, RegionUSCentral2: SuperRegionUSCentral, RegionUSCentral3: SuperRegionUSCentral, RegionUSCentral4: SuperRegionUSCentral, RegionUSWest1: SuperRegionUSWest, RegionUSWest2: SuperRegionUSWest, RegionUSWest3: SuperRegionUSWest, RegionUSWest4: SuperRegionUSWest, RegionUSEast1: SuperRegionUSEast, RegionUSEast2: SuperRegionUSEast, RegionUSEast3: SuperRegionUSEast, RegionUSEast4: SuperRegionUSEast, RegionEUWest1: SuperRegionEUWest, RegionEUWest2: SuperRegionEUWest, RegionEUWest3: SuperRegionEUWest, RegionEUEast1: SuperRegionEUEast, RegionEUEast2: SuperRegionEUEast, RegionEUEast3: SuperRegionEUEast, }
RegionToSuperRegion maps each Region to its SuperRegion (excludes RegionGlobal)
var Regions = map[string]Region{ "global": RegionGlobal, "us-central1": RegionUSCentral1, "us-central2": RegionUSCentral2, "us-west1": RegionUSWest1, "us-west2": RegionUSWest2, "us-west3": RegionUSWest3, "us-west4": RegionUSWest4, "us-east1": RegionUSEast1, "us-east4": RegionUSEast2, "us-east5": RegionUSEast3, "us-east-1": RegionUSEast1, "us-east-2": RegionUSEast2, "us-west-1": RegionUSWest1, "us-west-2": RegionUSWest2, "eastus": RegionUSEast1, "eastus2": RegionUSEast2, "westus": RegionUSWest1, "westus2": RegionUSWest2, "westus3": RegionUSWest3, "centralus": RegionUSCentral1, "northcentralus": RegionUSCentral2, "southcentralus": RegionUSCentral3, "westcentralus": RegionUSCentral1, "europe-west1": RegionEUWest1, "europe-west2": RegionEUWest2, "europe-west3": RegionEUWest3, "europe-north1": RegionEUEast1, "europe-west4": RegionEUWest1, "europe-west6": RegionEUWest1, "eu-west-1": RegionEUWest1, "eu-west-2": RegionEUWest2, "eu-west-3": RegionEUWest3, "eu-central-1": RegionEUEast1, "eu-central-2": RegionEUEast2, "eu-north-1": RegionEUEast3, "westeurope": RegionEUWest1, "northeurope": RegionEUWest2, "uksouth": RegionEUWest2, "ukwest": RegionEUWest3, "germanywestcentral": RegionEUEast1, "swedencentral": RegionEUEast2, "norwayeast": RegionEUEast3, "francecentral": RegionEUWest3, }
Regions maps canonical region strings to Region. Treat as read-only; do not mutate at runtime.
var Services = map[string]string{ AetherServiceIP: "aether", CatalystServiceIP: "catalyst", OtelServiceIP: "otel", RegistryServiceIP: "registry", StreamsServiceIP: "streams", IonServiceIP: "ion", }
Services maps IP address strings to service names
Functions ¶
func AgentSubnetForRegion ¶ added in v1.0.77
AgentSubnetForRegion will return the subnet for the agent network in the given region
func FormatCloudIdentifier ¶ added in v1.0.126
func FormatCloudIdentifier(cloudProvider CloudProvider, region, project string) string
FormatCloudIdentifier constructs a cloud identifier from cloud provider, region, and project/cloudstack This is useful when you already know the cloud/region/project without needing metadata detection
func GenerateHostname ¶ added in v1.0.105
GenerateHostname generates a hostname dynamically based on the cloud provider and region detected at runtime.
func GenerateHostnameWithCloudRegion ¶ added in v1.0.105
func GenerateHostnameWithCloudRegion(ctx context.Context, host string, suffix string, provider CloudProvider, region string) (string, error)
GenerateHostnameWithCloudRegion generates a hostname with cloud region information if you already have it.
func GenerateHostnamesForCloudRegions ¶ added in v1.0.105
func GenerateHostnamesForCloudRegions(ctx context.Context, host string, suffix string) ([]string, error)
GenerateHostnamesForCloudRegions generates hostnames for all cloud provider and region combinations defined in ProductionRegions.
func GenerateNonOverlappingIPv4Subnet ¶ added in v1.0.76
func GenerateNonOverlappingIPv4Subnet(existingNetworks []*net.IPNet, prefixLen int) (*net.IPNet, *net.IP, error)
GenerateNonOverlappingIPv4Subnet generates a non-overlapping ipv4 subnet with the given prefix size within the given range.
func GenerateServerIPv6FromIPv4 ¶ added in v1.0.76
func GenerateServerIPv6FromIPv4(region Region, network Network, tenantID string, ipv4 net.IP) (net.IP, *net.IPNet, error)
GenerateServerIPv6FromIPv4 generates a predictable IPv6 address by encoding the IPv4 address
func GenerateSuperRegionHostname ¶ added in v1.0.122
func GenerateSuperRegionHostname(ctx context.Context, host string, suffix string, region Region) (string, error)
GenerateSuperRegionHostname generates a hostname using only the super-region identifier. This creates provider-agnostic hostnames like project-123-usc.agentuity.cloud that can point to any cloudstack in that super-region regardless of provider or specific zone. Returns an error if the region does not have a super-region mapping (e.g., RegionGlobal).
func GenerateSuperRegionHostnameFromCurrentCloud ¶ added in v1.0.122
func GenerateSuperRegionHostnameFromCurrentCloud(ctx context.Context, host string, suffix string) (string, error)
GenerateSuperRegionHostnameFromCurrentCloud generates a super-region hostname using the current cloud environment. This creates provider-agnostic hostnames based on the detected cloud region.
func GenerateSuperRegionHostnamesForAllRegions ¶ added in v1.0.122
func GenerateSuperRegionHostnamesForAllRegions(ctx context.Context, host string, suffix string) ([]string, error)
GenerateSuperRegionHostnamesForAllRegions generates super-region hostnames for all defined super-regions. This is useful for creating DNS records that route to any provider in a geographic region. Skips regions without super-region mappings (e.g., RegionGlobal).
func GenerateUniqueIPv6 ¶ added in v1.0.76
GenerateUniqueIPv6 generates a unique IPv6 address with the Agentuity prefix
func GetCloudIdentifier ¶ added in v1.0.105
GetCloudIdentifier will return the cloud identifier for the current environment which is detected automatically at runtime.
func HadronSubnetForRegion ¶ added in v1.0.77
HadronSubnetForRegion will return the subnet for the hadron network in the given region
func IsAgentuityIPv6Prefix ¶ added in v1.0.76
IsAgentuityIPv6Prefix checks if the given IP address has the Agentuity prefix
func IsSuperRegion ¶ added in v1.0.137
IsSuperRegion returns true if the string passed in is a super region
func IsSuperRegionLocal ¶ added in v1.0.137
IsSuperRegionLocal returns true if the val is a local development super region
func SetCloudDetector ¶ added in v1.0.105
func SetCloudDetector(detector CloudDetector)
Types ¶
type CloudDetector ¶ added in v1.0.105
type CloudProvider ¶ added in v1.0.105
type CloudProvider string
const ( CloudProviderAWS CloudProvider = "aws" CloudProviderGCP CloudProvider = "gcp" CloudProviderAzure CloudProvider = "az" CloudProviderLocal CloudProvider = "local" )
type IPv6Address ¶
type IPv6Address struct {
// Region is the region of the IPv6 address.
Region Region
// Network is the network of the IPv6 address.
Network Network
// TenantID is the tenant ID of the IPv6 address.
TenantID string
// MachineID is the machine ID of the IPv6 address.
MachineID string
// HostID is the host ID of the IPv6 address.
HostID string
// contains filtered or unexported fields
}
func NewIPv6Address ¶
func NewIPv6Address(region Region, network Network, tenantID string, machineID string, hostID string) *IPv6Address
NewIPv6Address creates a new IPv6Address struct with the given parameters. It calculates the IPv6 address based on the provided parameters and stores them in the struct. The struct is returned as a pointer to the IPv6Address type.
func (*IPv6Address) IP ¶ added in v1.0.77
func (a *IPv6Address) IP() net.IP
func (*IPv6Address) MachineSubnet ¶
func (a *IPv6Address) MachineSubnet() string
MachineSubnet returns the subnet for the machine with a /96 mask.
func (*IPv6Address) MarshalJSON ¶
func (a *IPv6Address) MarshalJSON() ([]byte, error)
func (*IPv6Address) String ¶
func (a *IPv6Address) String() string
type Region ¶
type Region uint8
const ( RegionGlobal Region = 0x00 RegionUSCentral1 Region = 0x01 RegionUSWest1 Region = 0x02 RegionUSEast1 Region = 0x03 RegionUSCentral2 Region = 0x04 RegionUSCentral3 Region = 0x05 RegionUSWest2 Region = 0x06 RegionUSWest3 Region = 0x07 RegionUSEast2 Region = 0x08 RegionUSEast3 Region = 0x09 RegionUSCentral4 Region = 0x0A RegionUSWest4 Region = 0x0B RegionUSEast4 Region = 0x0C RegionEUEast1 Region = 0x0D RegionEUEast2 Region = 0x0E RegionEUEast3 Region = 0x0F RegionEUWest1 Region = 0x10 RegionEUWest2 Region = 0x11 RegionEUWest3 Region = 0x12 )
type SuperRegion ¶ added in v1.0.122
type SuperRegion string
const ( SuperRegionUSCentral SuperRegion = "usc" SuperRegionUSWest SuperRegion = "usw" SuperRegionUSEast SuperRegion = "use" SuperRegionEUEast SuperRegion = "eue" SuperRegionEUWest SuperRegion = "euw" SuperRegionLocal SuperRegion = "l" )
func GetCloudSuperRegion ¶ added in v1.0.122
func GetCloudSuperRegion(ctx context.Context) (SuperRegion, error)
GetCloudSuperRegion returns the SuperRegion for the current environment detected at runtime. Returns an error if the region does not have a super-region mapping or if detection fails.
func GetSuperRegion ¶ added in v1.0.122
func GetSuperRegion(region Region) (SuperRegion, error)
GetSuperRegion returns the SuperRegion for a given Region. Returns an error if the region does not have a super-region mapping (e.g., RegionGlobal).