Documentation ¶
Index ¶
- type NetLinkHandler
- func (h *NetLinkHandler) AddStaticRoute(route *netlink.Route) error
- func (h *NetLinkHandler) DelARPEntry(arpEntry *netlink.Neigh) error
- func (h *NetLinkHandler) DelStaticRoute(route *netlink.Route) error
- func (h *NetLinkHandler) GetARPEntries(interfaceIdx int) ([]netlink.Neigh, error)
- func (h *NetLinkHandler) GetStaticRoutes(interfaceIdx int) (v4Routes, v6Routes []netlink.Route, err error)
- func (h *NetLinkHandler) ReplaceStaticRoute(route *netlink.Route) error
- func (h *NetLinkHandler) SetARPEntry(arpEntry *netlink.Neigh) error
- type NetlinkAPI
- type NetlinkAPIRead
- type NetlinkAPIWrite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetLinkHandler ¶
type NetLinkHandler struct { }
NetLinkHandler is accessor for Netlink methods.
func NewNetLinkHandler ¶
func NewNetLinkHandler() *NetLinkHandler
NewNetLinkHandler creates new instance of Netlink handler.
func (*NetLinkHandler) AddStaticRoute ¶
func (h *NetLinkHandler) AddStaticRoute(route *netlink.Route) error
AddStaticRoute creates the new static route
func (*NetLinkHandler) DelARPEntry ¶
func (h *NetLinkHandler) DelARPEntry(arpEntry *netlink.Neigh) error
DelARPEntry removes an static ARP entry
func (*NetLinkHandler) DelStaticRoute ¶
func (h *NetLinkHandler) DelStaticRoute(route *netlink.Route) error
DelStaticRoute removes the static route
func (*NetLinkHandler) GetARPEntries ¶
func (h *NetLinkHandler) GetARPEntries(interfaceIdx int) ([]netlink.Neigh, error)
GetARPEntries reads all configured static ARP entries for given interface. <interfaceIdx> works as filter, if set to zero, all arp entries in the namespace are returned
func (*NetLinkHandler) GetStaticRoutes ¶
func (h *NetLinkHandler) GetStaticRoutes(interfaceIdx int) (v4Routes, v6Routes []netlink.Route, err error)
GetStaticRoutes reads all configured static routes with the given outgoing interface. <interfaceIdx> works as filter, if set to zero, all routes in the namespace are returned.
func (*NetLinkHandler) ReplaceStaticRoute ¶
func (h *NetLinkHandler) ReplaceStaticRoute(route *netlink.Route) error
ReplaceStaticRoute removes the static route
func (*NetLinkHandler) SetARPEntry ¶
func (h *NetLinkHandler) SetARPEntry(arpEntry *netlink.Neigh) error
SetARPEntry updates existing arp entry
type NetlinkAPI ¶
type NetlinkAPI interface { NetlinkAPIWrite NetlinkAPIRead }
NetlinkAPI interface covers all methods inside linux calls package needed to manage linux ARP entries and routes.
type NetlinkAPIRead ¶
type NetlinkAPIRead interface { // GetARPEntries reads all configured static ARP entries for given interface. // <interfaceIdx> works as filter, if set to zero, all arp entries in the namespace // are returned. GetARPEntries(interfaceIdx int) ([]netlink.Neigh, error) // GetStaticRoutes reads all configured static routes with the given outgoing // interface. // <interfaceIdx> works as filter, if set to zero, all routes in the namespace // are returned. GetStaticRoutes(interfaceIdx int) (v4Routes, v6Routes []netlink.Route, err error) }
NetlinkAPIRead interface covers read methods inside linux calls package needed to manage linux ARP entries and routes.
type NetlinkAPIWrite ¶
type NetlinkAPIWrite interface { /* ARP */ // SetARPEntry adds/modifies existing linux ARP entry. SetARPEntry(arpEntry *netlink.Neigh) error // DelARPEntry removes linux ARP entry. DelARPEntry(arpEntry *netlink.Neigh) error /* Routes */ // AddStaticRoute adds new linux static route. AddStaticRoute(route *netlink.Route) error // ReplaceStaticRoute changes existing linux static route. ReplaceStaticRoute(route *netlink.Route) error // DelStaticRoute removes linux static route. DelStaticRoute(route *netlink.Route) error }
NetlinkAPIWrite interface covers write methods inside linux calls package needed to manage linux ARP entries and routes.