netlink

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2014 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Packet netlink provide access to low level Netlink sockets and messages.

Actual implementations are in: netlink_linux.go netlink_darwin.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultGw

func AddDefaultGw(ip net.IP) error

Add a new default gateway. Identical to: ip route add default via $ip

func NetworkLinkAdd

func NetworkLinkAdd(name string, linkType string) error

Add a new network link of a specified type. This is identical to running: ip add link $name type $linkType

func NetworkLinkAddIp

func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error

Add an Ip address to an interface. This is identical to: ip addr add $ip/$ipNet dev $iface

func NetworkLinkUp

func NetworkLinkUp(iface *net.Interface) error

Bring up a particular network interface

func NetworkSetMTU

func NetworkSetMTU(iface *net.Interface, mtu int) error

Types

type IfAddrmsg

type IfAddrmsg struct {
	syscall.IfAddrmsg
}

func (*IfAddrmsg) ToWireFormat

func (msg *IfAddrmsg) ToWireFormat() []byte

type IfInfomsg

type IfInfomsg struct {
	syscall.IfInfomsg
}

func (*IfInfomsg) ToWireFormat

func (msg *IfInfomsg) ToWireFormat() []byte

type NetlinkRequest

type NetlinkRequest struct {
	syscall.NlMsghdr
	Data []NetlinkRequestData
}

func (*NetlinkRequest) AddData

func (rr *NetlinkRequest) AddData(data NetlinkRequestData)

func (*NetlinkRequest) ToWireFormat

func (rr *NetlinkRequest) ToWireFormat() []byte

type NetlinkRequestData

type NetlinkRequestData interface {
	ToWireFormat() []byte
}

type NetlinkSocket

type NetlinkSocket struct {
	// contains filtered or unexported fields
}

func (*NetlinkSocket) Close

func (s *NetlinkSocket) Close()

func (*NetlinkSocket) GetPid

func (s *NetlinkSocket) GetPid() (uint32, error)

func (*NetlinkSocket) HandleAck

func (s *NetlinkSocket) HandleAck(seq uint32) error

func (*NetlinkSocket) Receive added in v0.7.5

func (s *NetlinkSocket) Receive() ([]syscall.NetlinkMessage, error)

func (*NetlinkSocket) Send

func (s *NetlinkSocket) Send(request *NetlinkRequest) error

type Route added in v0.8.0

type Route struct {
	*net.IPNet
	Iface   *net.Interface
	Default bool
}

A Route is a subnet associated with the interface to reach it.

func NetworkGetRoutes

func NetworkGetRoutes() ([]Route, error)

Returns an array of IPNet for all the currently routed subnets on ipv4 This is similar to the first column of "ip route" output

type RtAttr

type RtAttr struct {
	syscall.RtAttr
	Data []byte
}

func (*RtAttr) ToWireFormat

func (attr *RtAttr) ToWireFormat() []byte

type RtMsg

type RtMsg struct {
	syscall.RtMsg
}

func (*RtMsg) ToWireFormat

func (msg *RtMsg) ToWireFormat() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL