Documentation
¶
Index ¶
- Constants
- Variables
- func CreateNamedNamespace(name string) (string, error)
- func DeleteNamedNamespace(name string) error
- func RunAsNsPath(nsPath string, fn func() error) (err error)
- type Bridge
- type Device
- type Link
- type Namespace
- type Neighbor
- type NeighborState
- type Route
- type RouteProtocol
- type RouteScope
- type Rule
- type VEth
- type VXLAN
Constants ¶
View Source
const NEIGHBOR_STATE_PERMANENT = netlink.NUD_PERMANENT
Variables ¶
View Source
var DefaultPrefix = netip.MustParsePrefix("0.0.0.0/0")
Functions ¶
func CreateNamedNamespace ¶
CreateNamedNamespace creates a new named network namespace, and returns its path
func DeleteNamedNamespace ¶
DeleteNamedNamespace deletes a named NS
func RunAsNsPath ¶
Types ¶
type Link ¶
type Link interface { Name() string Namespace() Namespace Type() string Delete() error GetAddr() ([]netip.Prefix, error) AddAddr(prefix netip.Prefix) error GetHardwareAddr() (string, error) SetHardwareAddr(hwAddr string) error GetMTU() (int, error) SetMTU(mtu int) error GetDevice() (Device, error) SetMaster(master Link) error SetNamespace(target Namespace) error SetName(name string) error SetUp() error }
type Namespace ¶
type Namespace interface { Close() error LinkAdd(name string, device Device) (Link, error) LinkFind(name string) (Link, error) LinkList() ([]Link, error) Path() string RedirectAdd(src, dst string) error RedirectDel(src string) error RouteAdd(route *Route) error RouteDel(route *Route) error GetDefaultRoute() ([]*Route, error) RouteList(filters ...*Route) ([]*Route, error) RuleAdd(rule *Rule) error RuleDel(rule *Rule) error RuleList(rule *Rule) ([]*Rule, error) NeighborAdd(neighbor *Neighbor) error NeighborList(filters ...*Neighbor) ([]*Neighbor, error) Run(fn func() error) error }
func OpenCurrentNamespace ¶
OpenCurrentNamespace returns the current network namespace
func OpenNamespace ¶
OpenNamespace returns a namespace specified by a path
func OpenNamespaceByName ¶
OpenNamespaceByName returns a namespace specified by a name
type Neighbor ¶
type Neighbor struct { IP netip.Addr HardwareAddr string Dev string State NeighborState }
type NeighborState ¶
type NeighborState uint16
func (NeighborState) MarshalJSON ¶
func (s NeighborState) MarshalJSON() ([]byte, error)
func (NeighborState) String ¶
func (s NeighborState) String() string
func (*NeighborState) UnmarshalJSON ¶
func (s *NeighborState) UnmarshalJSON(data []byte) error
type RouteProtocol ¶
type RouteProtocol netlink.RouteProtocol
func (RouteProtocol) MarshalJSON ¶
func (p RouteProtocol) MarshalJSON() ([]byte, error)
func (RouteProtocol) String ¶
func (p RouteProtocol) String() string
func (*RouteProtocol) UnmarshalJSON ¶
func (p *RouteProtocol) UnmarshalJSON(data []byte) error
type RouteScope ¶
func (RouteScope) MarshalJSON ¶
func (s RouteScope) MarshalJSON() ([]byte, error)
func (RouteScope) String ¶
func (s RouteScope) String() string
func (*RouteScope) UnmarshalJSON ¶
func (s *RouteScope) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.