network

package
v1.0.112 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AetherServiceIP = "fd15:d710:2d:c580:9dc5:aeeb::"

AetherServiceIP is the IP address for the aether service

View Source
const AgentSubnetGLOBAL = "fd15:d710:0040::/44"

AgentSubnetGLOBAL is the subnet for the agent network in the global region

View Source
const AgentSubnetUSCentral1 = "fd15:d710:0140::/44"

AgentSubnetUSCentral1 is the subnet for the agent network in the us-central1 region

View Source
const AgentSubnetUSEast1 = "fd15:d710:0340::/44"

AgentSubnetUSEast1 is the subnet for the agent network in the us-east1 region

View Source
const AgentSubnetUSWest1 = "fd15:d710:0240::/44"

AgentSubnetUSWest1 is the subnet for the agent network in the us-west1 region

View Source
const AgentuityIPV6ULAPrefix = "fd15:d710"

this is the agentuity IPV6 ULA prefix

View Source
const AgentuityTenantID = "agentuity"
View Source
const CatalystServiceIP = "fd15:d710:25:c500:9dc5:d408::"

CatalystServiceIP is the IP address for the catalyst service

View Source
const HadronSubnetGLOBAL = "fd15:d710:0030::/44"

HadronSubnetGLOBAL is the subnet for the hadron network in the global region

View Source
const HadronSubnetUSCentral1 = "fd15:d710:0130::/44"

HadronSubnetUSCentral1 is the subnet for the hadron network in the us-central1 region

View Source
const HadronSubnetUSEast1 = "fd15:d710:0330::/44"

HadronSubnetUSEast1 is the subnet for the hadron network in the us-east1 region

View Source
const HadronSubnetUSWest1 = "fd15:d710:0230::/44"

HadronSubnetUSWest1 is the subnet for the hadron network in the us-west1 region

View Source
const InternalServiceSubnet = "fd15:d710:0020::/44"

InternalServiceSubnet is the subnet for the internal service network

View Source
const OtelServiceIP = "fd15:d710:2a:68d0:9dc5:2763::"

OtelServiceIP is the IP address for the otel service

View Source
const RegistryServiceIP = "fd15:d710:2b:6d30:9dc5:e069::"

RegistryServiceIP is the IP address for the registry service

View Source
const StreamsServiceIP = "fd15:d710:29:9440:9dc5:96bf::"

StreamsServiceIP is the IP address for the streams service

Variables

View Source
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

View Source
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.

View Source
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.

View Source
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

func AgentSubnetForRegion(region Region) string

AgentSubnetForRegion will return the subnet for the agent network in the given region

func GenerateHostname added in v1.0.105

func GenerateHostname(ctx context.Context, host string, suffix string) (string, error)

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

func GenerateUniqueIPv6() (net.IP, error)

GenerateUniqueIPv6 generates a unique IPv6 address with the Agentuity prefix

func GetCloudIdentifier added in v1.0.105

func GetCloudIdentifier(ctx context.Context) (string, error)

GetCloudIdentifier will return the cloud identifier for the current environment which is detected automatically at runtime.

func HadronSubnetForRegion added in v1.0.77

func HadronSubnetForRegion(region Region) string

HadronSubnetForRegion will return the subnet for the hadron network in the given region

func IsAgentuityIPv6Prefix added in v1.0.76

func IsAgentuityIPv6Prefix(ip net.IP) bool

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 CloudDetector interface {
	Detect(ctx context.Context) (*cloudMetadata, error)
}

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 Network

type Network uint8
const (
	NetworkPrivateGravity   Network = 0x00
	NetworkExternalCustomer Network = 0x01
	NetworkPrivateServices  Network = 0x02
	NetworkHadron           Network = 0x03
	NetworkAgent            Network = 0x04
)

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
)

func GetRegion added in v1.0.77

func GetRegion(region string) Region

GetRegion returns a Region from a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL