Documentation
¶
Index ¶
- Constants
- func GetVrtSlotsSize() int
- type Firewall
- type Pool
- type Slot
- func (s *Slot) CloseFirewall() error
- func (s *Slot) ConfigureInternet(ctx context.Context, allowInternet bool) (e error)
- func (s *Slot) CreateNetwork() error
- func (s *Slot) HostCIDR() string
- func (s *Slot) HostIP() net.IP
- func (s *Slot) HostIPString() string
- func (s *Slot) HostMask() net.IPMask
- func (s *Slot) HostNet() *net.IPNet
- func (s *Slot) HyperloopIPString() string
- func (s *Slot) InitializeFirewall() error
- func (s *Slot) NamespaceID() string
- func (s *Slot) NamespaceIP() string
- func (s *Slot) RemoveNetwork() error
- func (s *Slot) ResetInternet(ctx context.Context) error
- func (s *Slot) TapCIDR() net.IPMask
- func (s *Slot) TapIP() net.IP
- func (s *Slot) TapIPString() string
- func (s *Slot) TapMAC() string
- func (s *Slot) TapMask() int
- func (s *Slot) TapMaskString() string
- func (s *Slot) TapName() string
- func (s *Slot) VethIP() net.IP
- func (s *Slot) VethName() string
- func (s *Slot) VpeerIP() net.IP
- func (s *Slot) VpeerName() string
- func (s *Slot) VrtMask() net.IPMask
- type Storage
- type StorageKV
- type StorageLocal
- type StorageMemory
Constants ¶
const ( NewSlotsPoolSize = 32 ReusedSlotsPoolSize = 100 )
Variables ¶
This section is empty.
Functions ¶
func GetVrtSlotsSize ¶
func GetVrtSlotsSize() int
Types ¶
type Firewall ¶
type Firewall struct {
// contains filtered or unexported fields
}
func NewFirewall ¶
func (*Firewall) AddAllowedIP ¶
AddAllowedIP adds a single CIDR to the allow set at runtime.
func (*Firewall) AddBlockedIP ¶
AddBlockedIP adds a single CIDR to the block set at runtime.
func (*Firewall) ResetAllCustom ¶
func (*Firewall) ResetAllowedCustom ¶
ResetAllowedCustom resets allow set back to original ranges.
func (*Firewall) ResetBlockedCustom ¶
ResetBlockedCustom resets the block set back to original ranges.
type Slot ¶
type Slot struct { Key string Idx int Firewall *Firewall // contains filtered or unexported fields }
Slot network allocation
For each slot, we allocate three IP addresses: Host IP - used to access the sandbox from the host machine Vpeer and Veth IPs - used by the sandbox to communicate with the host
Host default namespace creates a /16 CIDR block for the host IPs. Slot with Idx 1 will receive 10.11.0.1 and so on. Its allocated incrementally by slot Idx. Host mask is /32 because we only use one IP per slot.
Vrt addresses (vpeer and veth) are allocated from a /31 CIDR block so we can use CIDR for network link routing. By default, they are using 10.12.0.0/16 CIDR block, that can be configured via environment variable. Vpeer receives the first IP in the block, and Veth receives the second IP. Block is calculated as (slot index * addresses per slot allocation). Vrt address per slot is always 2, so we can allocate /31 CIDR block for each slot.
func (*Slot) CloseFirewall ¶
func (*Slot) ConfigureInternet ¶
func (*Slot) CreateNetwork ¶
func (*Slot) HostIPString ¶
func (*Slot) HyperloopIPString ¶
func (*Slot) InitializeFirewall ¶
func (*Slot) NamespaceID ¶
func (*Slot) NamespaceIP ¶
func (*Slot) RemoveNetwork ¶
func (*Slot) TapIPString ¶
func (*Slot) TapMaskString ¶
type StorageLocal ¶
type StorageLocal struct {
// contains filtered or unexported fields
}
func NewStorageLocal ¶
func NewStorageLocal(slotsSize int) (*StorageLocal, error)
func (*StorageLocal) Release ¶
func (s *StorageLocal) Release(ips *Slot) error
type StorageMemory ¶
type StorageMemory struct {
// contains filtered or unexported fields
}
func NewStorageMemory ¶
func NewStorageMemory(slotsSize int) (*StorageMemory, error)
func (*StorageMemory) Release ¶
func (s *StorageMemory) Release(ips *Slot) error