Package osl describes structures and interfaces which abstract os entities
This section is empty.
GenerateKey generates a sandbox key based on the passed container id.
SetBasePath sets the base url prefix for the ns path
type Iface struct { SrcName, DstPrefix, DstName string }
IfaceOption is a function option type to set interface options.
WithAdvertiseAddrInterval sets the interval between unsolicited ARP/NA messages sent to advertise a network interface's addresses.
WithAdvertiseAddrNMsgs sets the number of unsolicited ARP/NA messages that will be sent to advertise a network interface's addresses.
WithCreatedInContainer can be used to say the network driver created the interface in the container's network namespace (and, therefore, it doesn't need to be moved into that namespace.)
WithIPv4Address sets the IPv4 address of the interface.
WithIPv6Address sets the IPv6 address of the interface.
WithIsBridge sets whether the interface is a bridge.
WithLinkLocalAddresses set the link-local IP addresses of the interface.
WithMACAddress sets the interface MAC-address.
WithMaster sets the master interface (if any) for this interface. The master interface name should refer to the srcName of a previously added interface of type bridge.
WithRoutes sets the interface routes.
WithSysctls sets the interface sysctls.
type Interface struct { }
Interface represents the settings and identity of a network device. It is used as a return type for Network.Link, and it is common practice for the caller to use this information when moving interface SrcName from host namespace to DstName in a different net namespace with the appropriate network settings.
Address returns the IPv4 address for the interface.
AddressIPv6 returns the IPv6 address for the interface.
Bridge returns true if the interface is a bridge.
DstName returns the final interface name in the target network namespace. It's generated based on the prefix passed to Namespace.AddInterface.
LinkLocalAddresses returns the link-local IP addresses assigned to the interface.
Remove an interface from the sandbox by renaming to original name and moving it out of the sandbox.
Routes returns IP routes for the interface.
SrcName returns the name of the interface in the origin network namespace.
Statistics returns the sandbox's side veth interface statistics.
type Namespace struct { }
Namespace represents a network sandbox. It represents a Linux network namespace, and moves an interface into it when called on method AddInterface or sets the gateway etc. It holds a list of Interfaces, routes etc., and more can be added dynamically.
func NewSandbox ¶NewSandbox provides a new Namespace instance created in an os specific way provided a key which uniquely identifies the sandbox.
AddAliasIP adds the passed IP address to the named interface
AddInterface creates an Interface that represents an existing network interface (except for bridge interfaces, which are created here).
The network interface will be reconfigured according the options passed, and it'll be renamed from srcName into either dstName if it's not empty, or to an auto-generated dest name that combines the provided dstPrefix and a numeric suffix.
It's safe to call concurrently.
AddNeighbor adds a neighbor entry into the sandbox.
AddStaticRoute adds a static route to the sandbox.
ApplyOSTweaks applies operating system specific knobs on the sandbox.
DeleteNeighbor deletes a neighbor entry from the sandbox.
To delete an entry inserted by [AddNeighbor] the caller must provide the same parameters used to add it.
Destroy destroys the sandbox.
DisableARPForVIP disables ARP replies and requests for VIP addresses on a particular interface.
Gateway returns the IPv4 gateway for the sandbox.
GatewayIPv6 returns the IPv6 gateway for the sandbox.
GetLoopbackIfaceName returns the name of the loopback interface
IPv6LoEnabled returns true if the loopback interface had an IPv6 address when last checked. It's always checked on the first call, and by RefreshIPv6LoEnabled. ('::1' is assigned by the kernel if IPv6 is enabled.)
Interfaces returns the collection of Interface previously added with the AddInterface method. Note that this doesn't include network interfaces added in any other way (such as the default loopback interface which is automatically created on creation of a sandbox).
InvokeFunc invoke a function in the network namespace.
Key returns the path where the network namespace is mounted.
RefreshIPv6LoEnabled refreshes the cached result returned by IPv6LoEnabled.
RemoveAliasIP removes the passed IP address from the named interface
RemoveInterface removes an interface from the namespace by renaming to original name and moving it out of the sandbox.
RemoveStaticRoute removes a static route from the sandbox.
RestoreInterfaces restores the network namespace's interfaces.
SetDefaultRouteIPv4 sets up a connected route to 0.0.0.0 via the Interface with srcName, if that Interface has a route to 0.0.0.0. Otherwise, it returns an error.
SetDefaultRouteIPv6 sets up a connected route to [::] via the Interface with srcName, if that Interface has a route to [::]. Otherwise, it returns an error.
SetGateway sets the default IPv4 gateway for the sandbox. It is a no-op if the given gateway is empty.
SetGatewayIPv6 sets the default IPv6 gateway for the sandbox. It is a no-op if the given gateway is empty.
StaticRoutes returns additional static routes for the sandbox. Note that directly connected routes are stored on the particular interface they refer to.
UnsetDefaultRouteIPv4 unsets the previously set default IPv4 default route in the sandbox. It is a no-op if no gateway was set.
UnsetDefaultRouteIPv6 unsets the previously set default IPv6 default route in the sandbox. It is a no-op if no gateway was set.
UnsetGateway the previously set default IPv4 gateway in the sandbox. It is a no-op if no gateway was set.
UnsetGatewayIPv6 unsets the previously set default IPv6 gateway in the sandbox. It is a no-op if no gateway was set.
type NeighOption func(nh *neigh)
NeighOption is a function option type to set neighbor options.
WithLinkName sets the srcName of the link to use in the neighbor entry.
type NeighborSearchError struct { }
NeighborSearchError indicates that the neighbor is already present
type SandboxType ¶SandboxType specify the time of the sandbox, this can be used to apply special configs
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4