Documentation ¶
Index ¶
- Constants
- func NewLinkPair() (netlink.Link, netlink.Link, error)
- type Builder
- type NetNS
- func (ns *NetNS) Cleanup() error
- func (ns *NetNS) Name() string
- func (ns *NetNS) Set() error
- func (ns *NetNS) SharedLinkAddress() *netlink.Addr
- func (ns *NetNS) UnsafeExec(callback func(), beforeCallbackFuncs ...func() error) <-chan error
- func (ns *NetNS) UnsafeExecInLoop(numOfIterations uint, delay time.Duration, callback func(), ...) <-chan error
- func (ns *NetNS) Unset() error
- func (ns *NetNS) Veth() *Veth
- type Veth
Constants ¶
View Source
const Loopback = "lo"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewNetNSBuilder ¶
func NewNetNSBuilder() *Builder
func (*Builder) WithBeforeExecFuncs ¶
func (*Builder) WithNameSeed ¶
type NetNS ¶
type NetNS struct {
// contains filtered or unexported fields
}
func (*NetNS) SharedLinkAddress ¶ added in v0.6.0
func (*NetNS) UnsafeExec ¶
UnsafeExec will execute provided callback function in the created network namespace from the *NetNS. It was named UnsafeExec instead of Exec as you have to be very cautious and remember to not spawn new goroutines inside provided callback (more info in warning below)
WARNING!:
Don't spawn new goroutines inside callback functions as the one inside UnsafeExec function have exclusive access to the current network namespace, and you should assume, that any new goroutine will be placed in the different namespace
func (*NetNS) UnsafeExecInLoop ¶
func (ns *NetNS) UnsafeExecInLoop( numOfIterations uint, delay time.Duration, callback func(), beforeCallbackFuncs ...func() error, ) <-chan error
UnsafeExecInLoop will execute provided callback function inside the created network namespace in a loop. It was named UnsafeExecInLoop instead of ExecInLoop as you have to be very cautious and remember to not spawn new goroutines inside provided callback (more info in warning below)
WARNING!:
Don't spawn new goroutines inside callback functions as the one inside UnsafeExecInLoop function have exclusive access to the current network namespace, and you should assume, that any new goroutine will be placed in the different namespace
type Veth ¶
type Veth struct {
// contains filtered or unexported fields
}
func (*Veth) AddressCIDR ¶
func (*Veth) PeerAddress ¶
func (*Veth) PeerAddressCIDR ¶
Click to show internal directories.
Click to hide internal directories.