Documentation ¶
Index ¶
- Constants
- Variables
- func CreateNAT(hostInterface string) error
- func RemoveNAT(hostInterface string) error
- type IP
- type IPPair
- type IPTable
- func (t *IPTable) AvailableIPs() uint64
- func (t *IPTable) AvailablePairs() uint64
- func (t *IPTable) GetIP(ctx context.Context) (*IP, error)
- func (t *IPTable) GetPair(ctx context.Context) (*IPPair, error)
- func (t *IPTable) Open(ctx context.Context) error
- func (t *IPTable) ReleaseIP(ctx context.Context, ip *IP) error
- func (i *IPTable) ReleasePair(ctx context.Context, ipPair *IPPair) error
- type Namespace
Constants ¶
View Source
const ( PairMask = 30 GatewayReserved = 2 )
Variables ¶
View Source
var ( ErrInvalidCIDRSize = errors.New("invalid CIDR size") ErrCouldNotParseCIDR = errors.New("could not parse CIDR") ErrCouldNotCreateNewPrefix = errors.New("could not create new prefix") ErrCouldNotAcquireIP = errors.New("could not acquire IP") ErrCouldNotReleaseIP = errors.New("could not release IP") ErrCouldNotAcquireChildPrefix = errors.New("could not acquire child prefix") ErrCouldNotReleaseChildPrefix = errors.New("could not release child prefix") )
View Source
var ( ErrCouldNotGetOriginalNamespace = errors.New("could not get original namespace") ErrCouldNotNewNamespace = errors.New("could not create new namespace") ErrCouldNotAddTapInterface = errors.New("could not add tap interface") ErrCouldNotParseGatewaySubnet = errors.New("could not parse gateway subnet") ErrCouldNotAddAddressToInterface = errors.New("could not add address to interface") ErrCouldNotParseMACAddress = errors.New("could not parse MAC address") ErrCouldNotSetHardwareAddress = errors.New("could not set hardware address") ErrCouldNotSetLinkUp = errors.New("could not set link up") ErrCouldNotAddVethInterface = errors.New("could not add veth interface") ErrCouldNotGetVethInterface = errors.New("could not get veth interface") ErrCouldNotSetNamespacePid = errors.New("could not set namespace pid") ErrCouldNotParseInternalVethSubnet = errors.New("could not parse internal veth subnet") ErrCouldNotSetOriginalNamespace = errors.New("could not set original namespace") ErrCouldNotParseExternalVethSubnet = errors.New("could not parse external veth subnet") ErrCouldNotParseDefaultAddress = errors.New("could not parse default address") ErrCouldNotAddRoute = errors.New("could not add route") ErrCouldNotNewIPTable = errors.New("could not create new iptables instance") ErrCouldNotAppendIPTableRule = errors.New("could not append iptables rule") ErrCouldNotDeleteIPTableRule = errors.New("could not delete iptables rule") ErrCouldNotDeleteRoute = errors.New("could not delete route") ErrCouldNotDeleteLink = errors.New("could not delete link") ErrCouldNotSetLinkDown = errors.New("could not set link down") ErrCouldNotDeleteNamespace = errors.New("could not delete namespace") )
View Source
var ( ErrCouldNotWriteIPForwarding = errors.New("could not enable IP forwarding") ErrCouldNotCreateIPTablesInstance = errors.New("could not create iptables instance") ErrCouldNotAppendPostRoutingRule = errors.New("could not append POSTROUTING rule to nat table") ErrCouldNotAppendForwardRule = errors.New("could not append FORWARD rule to filter table") ErrCouldNotDeleteForwardRule = errors.New("could not delete FORWARD rule from filter table") ErrCouldNotDeletePostRoutingRule = errors.New("could not delete POSTROUTING rule from nat table") )
Functions ¶
Types ¶
type IPPair ¶
type IPPair struct {
// contains filtered or unexported fields
}
func (*IPPair) GetFirstIP ¶
func (*IPPair) GetSecondIP ¶
type IPTable ¶
type IPTable struct {
// contains filtered or unexported fields
}
func (*IPTable) AvailableIPs ¶
func (*IPTable) AvailablePairs ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func NewNamespace ¶
func NewNamespace( id string, hostInterface string, namespaceInterface string, namespaceInterfaceGateway string, namespaceInterfaceNetmask uint32, hostVethInternalIP string, hostVethExternalIP string, namespaceInterfaceIP string, namespaceVethIP string, blockedSubnet string, namespaceInterfaceMAC string, allowIncomingTraffic bool, ) *Namespace
Click to show internal directories.
Click to hide internal directories.