network

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostPortAlloc

func HostPortAlloc(used []uint32, port uint32) uint32

HostPortAlloc allocates a host port from the allocation range.

If port > 0, it attempts to claim that specific port. Returns 0 if the port is already taken.

If port == 0, it auto-selects a free port:

  1. 10 random attempts within [inapi.HostPortMin, inapi.HostPortMax]
  2. Sequential scan from the last allocated port + 1
  3. Wrap-around scan from inapi.HostPortMin

Returns the allocated port, or 0 if no port is available.

Types

type NetworkManager

type NetworkManager struct {
	Map *inapi.ZoneNetworkMap

	Version uint64

	Bridge   uint32
	Instance uint32

	Hosts map[string]*inapi.ZoneNetworkMap_Host
	// contains filtered or unexported fields
}

func NewNetworkManager

func NewNetworkManager() *NetworkManager

func (*NetworkManager) AllocHostSubNetwork

func (nm *NetworkManager) AllocHostSubNetwork(zone, hostId, instanceId string, repId uint32) string

func (*NetworkManager) Clone

func (nm *NetworkManager) Clone() *inapi.ZoneNetworkMap

func (*NetworkManager) HostNetwork

func (nm *NetworkManager) HostNetwork(hostId string) *inapi.ZoneNetworkMap_Host

func (*NetworkManager) HostPeerIp

func (nm *NetworkManager) HostPeerIp(hostId string) (string, bool)

func (*NetworkManager) IsChanged

func (nm *NetworkManager) IsChanged() bool

func (*NetworkManager) IsReady

func (nm *NetworkManager) IsReady() bool

func (*NetworkManager) Iter

func (nm *NetworkManager) Iter(fn func(hostId string, hostNet *inapi.ZoneNetworkMap_Host))

func (*NetworkManager) RefreshHostNetwork

func (nm *NetworkManager) RefreshHostNetwork(zone string, host *inapi.Host) (bool, error)

func (*NetworkManager) Restore

func (nm *NetworkManager) Restore(zoneName string) error

func (*NetworkManager) VpcInstance

func (nm *NetworkManager) VpcInstance(ipv4 string) string

func (*NetworkManager) ZoneSetup

func (nm *NetworkManager) ZoneSetup(zoneName, bridgeCIDR, instanceCIDR, domain string) error

ZoneSetup initializes the zone-level VPC CIDRs.

Jump to

Keyboard shortcuts

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