Documentation
¶
Index ¶
- func HostPortAlloc(used []uint32, port uint32) uint32
- type NetworkManager
- func (nm *NetworkManager) AllocHostSubNetwork(zone, hostId, instanceId string, repId uint32) string
- func (nm *NetworkManager) Clone() *inapi.ZoneNetworkMap
- func (nm *NetworkManager) HostNetwork(hostId string) *inapi.ZoneNetworkMap_Host
- func (nm *NetworkManager) HostPeerIp(hostId string) (string, bool)
- func (nm *NetworkManager) IsChanged() bool
- func (nm *NetworkManager) IsReady() bool
- func (nm *NetworkManager) Iter(fn func(hostId string, hostNet *inapi.ZoneNetworkMap_Host))
- func (nm *NetworkManager) RefreshHostNetwork(zone string, host *inapi.Host) (bool, error)
- func (nm *NetworkManager) Restore(zoneName string) error
- func (nm *NetworkManager) VpcInstance(ipv4 string) string
- func (nm *NetworkManager) ZoneSetup(zoneName, bridgeCIDR, instanceCIDR, domain string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostPortAlloc ¶
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:
- 10 random attempts within [inapi.HostPortMin, inapi.HostPortMax]
- Sequential scan from the last allocated port + 1
- 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 (*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.
Click to show internal directories.
Click to hide internal directories.