Documentation
¶
Index ¶
- Constants
- func AddPortMapping(hostInterface string, hostPort int, guestIP string, guestPort int, ...) error
- func Bootstrap() error
- func CreatePointToPointTap(name, hostIP, guestIP string, uid, gid int) error
- func CreateTap(name, ipAddr string) error
- func DeleteTap(name string) error
- func RemovePortMapping(hostInterface string, hostPort int, guestIP string, guestPort int, ...) error
- func Teardown() error
- type IPAM
- type PortManager
Constants ¶
const Subnet = "10.200.0.0/16"
Subnet is the internal IP range used for Firecracker microVMs.
Variables ¶
This section is empty.
Functions ¶
func AddPortMapping ¶ added in v0.5.5
func AddPortMapping(hostInterface string, hostPort int, guestIP string, guestPort int, protocol string) error
AddPortMapping adds DNAT and FORWARD rules for a port mapping.
func Bootstrap ¶
func Bootstrap() error
Bootstrap dynamically configures the host's networking stack to allow the MicroVMs to reach the internet via NAT and IP Forwarding.
func CreatePointToPointTap ¶
CreatePointToPointTap creates a new TAP interface and establishes a Point-to-Point peer route. Uses netlink syscalls directly to avoid fork/exec overhead and kernel RTNL lock contention from concurrent `ip` command invocations.
Types ¶
type IPAM ¶
type IPAM struct {
// contains filtered or unexported fields
}
IPAM manages the allocation of /32 point-to-point IP addresses for Firecracker MicroVMs out of a given CIDR block.
type PortManager ¶ added in v0.5.5
type PortManager struct {
// contains filtered or unexported fields
}
PortManager tracks host port usage across all MicroVMs managed by the daemon. It supports both explicit "deterministic" allocation and random "ephemeral" allocation.
func NewPortManager ¶ added in v0.5.5
func NewPortManager(start, end int) *PortManager
NewPortManager initializes a new PortManager with the specified ephemeral range.
func (*PortManager) Allocate ¶ added in v0.5.5
func (pm *PortManager) Allocate(requestedPort int, protocol string, iface string, vmID string) (int, error)
Allocate attempts to reserve a port for a specific VM. If requestedPort is 0, it picks an available port from the ephemeral pool. If requestedPort is > 0, it checks if the port is available and claims it.
func (*PortManager) Release ¶ added in v0.5.5
func (pm *PortManager) Release(port int)
Release frees a previously allocated port.