Documentation
¶
Index ¶
- Constants
- Variables
- func AgentSubnetForRegion(region Region) 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 GenerateUniqueIPv6() (net.IP, error)
- func GetCloudIdentifier(ctx context.Context) (string, error)
- func HadronSubnetForRegion(region Region) string
- func IsAgentuityIPv6Prefix(ip net.IP) bool
- func SetCloudDetector(detector CloudDetector)
- type CloudDetector
- type CloudProvider
- type IPv6Address
- type Network
- type Region
Constants ¶
const AetherServiceIP = "fd15:d710:2d:c580:9dc5:aeeb::"
AetherServiceIP is the IP address for the aether service
const AgentSubnetGLOBAL = "fd15:d710:0040::/44"
AgentSubnetGLOBAL is the subnet for the agent network in the global region
const AgentSubnetUSCentral1 = "fd15:d710:0140::/44"
AgentSubnetUSCentral1 is the subnet for the agent network in the us-central1 region
const AgentSubnetUSEast1 = "fd15:d710:0340::/44"
AgentSubnetUSEast1 is the subnet for the agent network in the us-east1 region
const AgentSubnetUSWest1 = "fd15:d710:0240::/44"
AgentSubnetUSWest1 is the subnet for the agent network in the us-west1 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 HadronSubnetGLOBAL = "fd15:d710:0030::/44"
HadronSubnetGLOBAL is the subnet for the hadron network in the global region
const HadronSubnetUSCentral1 = "fd15:d710:0130::/44"
HadronSubnetUSCentral1 is the subnet for the hadron network in the us-central1 region
const HadronSubnetUSEast1 = "fd15:d710:0330::/44"
HadronSubnetUSEast1 is the subnet for the hadron network in the us-east1 region
const HadronSubnetUSWest1 = "fd15:d710:0230::/44"
HadronSubnetUSWest1 is the subnet for the hadron network in the us-west1 region
const InternalServiceSubnet = "fd15:d710:0020::/44"
InternalServiceSubnet is the subnet for the internal service network
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), }
Addresses is a map of service names to their IP addresses
var ProductionRegions = map[CloudProvider][]Region{ CloudProviderAWS: { RegionUSCentral1, }, CloudProviderGCP: { RegionUSCentral1, }, CloudProviderAzure: { RegionUSCentral1, }, }
ProductionRegions returns a map of the production regions for each cloud provider currently supported.
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, }
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", }
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 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 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 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 )