isolated

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CapabilityApplianceV1    Capability = "isolated.appliance.v1"
	CapabilityNetworkV1      Capability = "isolated.network.v1"
	CapabilityRelayV1        Capability = "isolated.relay.v1"
	CapabilityNATV1          Capability = "isolated.nat.v1"
	CapabilityStatsV1        Capability = "isolated.stats.v1"
	CapabilityStaticConfigV1 Capability = "isolated.static-config.v1"

	MinimumProtocolVersion uint32 = 3
	MaximumProtocolVersion uint32 = 3
)
View Source
const (
	BootstrapNetworkNone      = "none"
	BootstrapNetworkPreStaged = "pre_staged"
	BootstrapNetworkNAT       = "nat_enabled"
)
View Source
const (
	MaxPhysicalNameLength    = 63
	MaxWindowsNodeNameLength = 15
)
View Source
const (
	PrivateNetworkPrefixBits   = 26
	PrivateSubnetCount         = 1 << (PrivateNetworkPrefixBits - 20)
	FirstGuestAddressOffset    = 10
	LastGuestAddressOffset     = 62
	MaxNetworksPerOrchestrator = 16
	MaxVMsPerOrchestrator      = 100
)
View Source
const (
	MinimumApplianceSchema uint32 = 5
	MaximumApplianceSchema uint32 = 5
)
View Source
const PhysicalHostIdentityVersion = "lablink-physical-host/v1"
View Source
const ShortIDLength = 12

Variables

This section is empty.

Functions

func CheckAgentCompatibility

func CheckAgentCompatibility(
	agent AgentCompatibility,
	requirements CompatibilityRequirements,
) error

func CheckOrchestratorCompatibility

func CheckOrchestratorCompatibility(agent AgentCompatibility, serverVersion string) error

func DeterministicMAC

func DeterministicMAC(resourceID string) (string, error)

func ErrorCode

func ErrorCode(err error) string

func GuestAddress

func GuestAddress(prefix netip.Prefix, offset int) (netip.Addr, error)

func LinuxStaticNetworkBootstrapScript

func LinuxStaticNetworkBootstrapScript(
	ip string,
	prefixLength int,
	gateway, mac string,
	dns []string,
) (string, error)

func LinuxStaticNetworkConfig

func LinuxStaticNetworkConfig(
	ip string,
	prefixLength int,
	gateway, mac string,
	dns []string,
) (string, error)

func NormalizeHostAlias

func NormalizeHostAlias(value string) (string, error)

func NormalizeHumanPrefix

func NormalizeHumanPrefix(value string) string

func ParseDNSServers

func ParseDNSServers(data string) ([]string, error)

func PhysicalName

func PhysicalName(humanPrefix, immutableID string, maxLength int) (string, error)

func PrivateGateway

func PrivateGateway(prefix netip.Prefix) netip.Addr

func PrivateSubnet

func PrivateSubnet(index int) (netip.Prefix, error)

func SubnetIndexFromCIDR

func SubnetIndexFromCIDR(cidr string) (int, error)

func ValidateBootstrapPolicy

func ValidateBootstrapPolicy(
	requirement string,
	natEnabled, knownNetworkBootstrap, domainJoin bool,
	services []ReachableService,
) error

func ValidatePhysicalName

func ValidatePhysicalName(value string, maxLength int) error

func WindowsStaticNetworkScript

func WindowsStaticNetworkScript(
	ip string,
	prefixLength int,
	gateway, mac string,
	dns []string,
) (string, error)

Types

type AgentCompatibility

type AgentCompatibility struct {
	Node            string
	AgentVersion    string
	Capabilities    []string
	ProtocolVersion uint32
}

type ApplianceClient

type ApplianceClient interface {
	CheckReadiness(context.Context, string) (ApplianceReadiness, error)
	InspectApplianceState(context.Context, string) (ApplianceSnapshot, error)
	ConfigureStatic(
		context.Context,
		string,
		appliance.StaticConfig,
		[]appliance.RetiredNAT,
	) (ApplianceSnapshot, error)
	GetRelayStats(context.Context, string, string) (appliance.RelayStats, error)
	ValidateRelay(context.Context, string, string, bool) (RelayValidation, error)
}

type ApplianceRPCClient

type ApplianceRPCClient struct {
	// contains filtered or unexported fields
}

func NewApplianceClient

func NewApplianceClient(
	reg *registry.Registry,
	pool *agentclient.Pool,
	serverVersion string,
) *ApplianceRPCClient

func NewApplianceRPCClient

func NewApplianceRPCClient(
	reg applianceNodeRegistry,
	pool applianceClientPool,
	serverVersion string,
) *ApplianceRPCClient

func (*ApplianceRPCClient) CheckReadiness

func (c *ApplianceRPCClient) CheckReadiness(
	ctx context.Context,
	orchestratorID string,
) (ApplianceReadiness, error)

func (*ApplianceRPCClient) ConfigureStatic

func (c *ApplianceRPCClient) ConfigureStatic(
	ctx context.Context,
	orchestratorID string,
	config appliance.StaticConfig,
	retire []appliance.RetiredNAT,
) (ApplianceSnapshot, error)

func (*ApplianceRPCClient) GetRelayStats

func (c *ApplianceRPCClient) GetRelayStats(
	ctx context.Context,
	orchestratorID, relayID string,
) (appliance.RelayStats, error)

func (*ApplianceRPCClient) InspectApplianceState

func (c *ApplianceRPCClient) InspectApplianceState(
	ctx context.Context,
	orchestratorID string,
) (ApplianceSnapshot, error)

func (*ApplianceRPCClient) ValidateRelay

func (c *ApplianceRPCClient) ValidateRelay(
	ctx context.Context,
	orchestratorID, relayID string,
	probeTarget bool,
) (RelayValidation, error)

type ApplianceReadiness

type ApplianceReadiness struct {
	Node            string
	AgentVersion    string
	Capabilities    []string
	ProtocolVersion uint32
	Ready           bool
	Error           string
}

type ApplianceSnapshot

type ApplianceSnapshot struct {
	SchemaVersion   uint32
	ProtocolVersion uint32
	Ready           bool
	MainIPv4        string
	PolicyVerified  bool
	IPv4Forwarding  bool
	Error           string
	Config          appliance.StaticSnapshot
}

type Capability

type Capability string

func RequiredOrchestratorCapabilities

func RequiredOrchestratorCapabilities() []Capability

type CompatibilityError

type CompatibilityError struct {
	Code                string
	Node                string
	AgentVersion        string
	ServerVersion       string
	MissingCapabilities []Capability
	ProtocolVersion     uint32
	SupportedProtocol   ProtocolRange
}

func (*CompatibilityError) Error

func (e *CompatibilityError) Error() string

type CompatibilityRequirements

type CompatibilityRequirements struct {
	Capabilities  []Capability
	ProtocolRange ProtocolRange
	ServerVersion string
}

func OrchestratorCompatibilityRequirements

func OrchestratorCompatibilityRequirements(serverVersion string) CompatibilityRequirements

func (CompatibilityRequirements) Validate

func (r CompatibilityRequirements) Validate() error

type DomainError

type DomainError struct {
	Code    string
	Message string
}

func (*DomainError) Error

func (e *DomainError) Error() string

type HostIdentityChangedError

type HostIdentityChangedError struct {
	Alias    string
	Expected PhysicalHostID
	Observed PhysicalHostID
}

func (*HostIdentityChangedError) Error

func (e *HostIdentityChangedError) Error() string

type HostReference

type HostReference struct {
	Alias      string
	PhysicalID PhysicalHostID
}

func NewHostReference

func NewHostReference(alias string, physicalID PhysicalHostID) (HostReference, error)

func (HostReference) CanonicalKey

func (r HostReference) CanonicalKey() string

func (HostReference) SamePhysicalHost

func (r HostReference) SamePhysicalHost(other HostReference) bool

func (HostReference) Validate

func (r HostReference) Validate() error

func (HostReference) VerifyObserved

func (r HostReference) VerifyObserved(observed PhysicalHostID) error

type NetworkID

type NetworkID string

func NewNetworkID

func NewNetworkID() (NetworkID, error)

func ParseNetworkID

func ParseNetworkID(value string) (NetworkID, error)

func (NetworkID) Short

func (id NetworkID) Short() string

func (NetworkID) String

func (id NetworkID) String() string

func (NetworkID) Validate

func (id NetworkID) Validate() error

type NetworkPhysicalNames

type NetworkPhysicalNames struct {
	HyperVSwitchName        string
	OrchestratorAdapterName string
}

func NetworkNames

func NetworkNames(id NetworkID) (NetworkPhysicalNames, error)

type OperationID

type OperationID string

func NewOperationID

func NewOperationID() (OperationID, error)

func ParseOperationID

func ParseOperationID(value string) (OperationID, error)

func (OperationID) Short

func (id OperationID) Short() string

func (OperationID) String

func (id OperationID) String() string

func (OperationID) Validate

func (id OperationID) Validate() error

type OrchestratorID

type OrchestratorID string

func NewOrchestratorID

func NewOrchestratorID() (OrchestratorID, error)

func ParseOrchestratorID

func ParseOrchestratorID(value string) (OrchestratorID, error)

func (OrchestratorID) Short

func (id OrchestratorID) Short() string

func (OrchestratorID) String

func (id OrchestratorID) String() string

func (OrchestratorID) Validate

func (id OrchestratorID) Validate() error

type OrchestratorPhysicalNames

type OrchestratorPhysicalNames struct {
	HyperVName string
	NodeName   string
}

type PhysicalHostID

type PhysicalHostID string

func ParsePhysicalHostID

func ParsePhysicalHostID(value string) (PhysicalHostID, error)

func (PhysicalHostID) String

func (id PhysicalHostID) String() string

func (PhysicalHostID) Validate

func (id PhysicalHostID) Validate() error

type PhysicalHostIdentity

type PhysicalHostIdentity struct {
	MachineGUID string
	SMBIOSUUID  string
	ID          PhysicalHostID
}

func DerivePhysicalHostIdentity

func DerivePhysicalHostIdentity(machineGUID, smbiosUUID string) (PhysicalHostIdentity, error)

type ProtocolRange

type ProtocolRange struct {
	Minimum uint32
	Maximum uint32
}

func (ProtocolRange) Contains

func (r ProtocolRange) Contains(version uint32) bool

func (ProtocolRange) Validate

func (r ProtocolRange) Validate() error

type ReachableService

type ReachableService struct {
	Kind    string `json:"kind"`
	Address string `json:"address"`
	Port    int    `json:"port,omitempty"`
}

type RelayID

type RelayID string

func NewRelayID

func NewRelayID() (RelayID, error)

func ParseRelayID

func ParseRelayID(value string) (RelayID, error)

func (RelayID) Short

func (id RelayID) Short() string

func (RelayID) String

func (id RelayID) String() string

func (RelayID) Validate

func (id RelayID) Validate() error

type RelayValidation

type RelayValidation struct {
	Relay           appliance.Relay
	ListenerValid   bool
	MappingValid    bool
	TargetReachable bool
	Message         string
}

type RouteConflictObservation

type RouteConflictObservation struct {
	Candidate netip.Prefix
	Route     RouteObservation
}

func FindPrivateRouteConflicts

func FindPrivateRouteConflicts(
	candidate netip.Prefix,
	routes []RouteObservation,
) []RouteConflictObservation

type RouteObservation

type RouteObservation struct {
	DestinationPrefix string `json:"destination_prefix"`
	NextHop           string `json:"next_hop"`
	InterfaceAlias    string `json:"interface_alias"`
	RouteMetric       int    `json:"route_metric"`
}

type VMID

type VMID string

func NewVMID

func NewVMID() (VMID, error)

func ParseVMID

func ParseVMID(value string) (VMID, error)

func (VMID) Short

func (id VMID) Short() string

func (VMID) String

func (id VMID) String() string

func (VMID) Validate

func (id VMID) Validate() error

type VMPhysicalNames

type VMPhysicalNames struct {
	HyperVName         string
	NodeName           string
	PrivateAdapterName string
}

func VMNames

func VMNames(id VMID) (VMPhysicalNames, error)

Jump to

Keyboard shortcuts

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