routebsd

package standard library
master (6c3b5a2) Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package routebsd supports reading interface addresses on BSD systems. This is a very stripped down version of x/net/route, for use by the net package in the standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr interface {
	// Family returns an address family.
	Family() int
}

An Addr represents an address associated with packet routing.

type InetAddr

type InetAddr struct {
	IP netip.Addr
}

An InetAddr represent an internet address using IPv4 or IPv6.

func (*InetAddr) Family

func (a *InetAddr) Family() int

type InterfaceAddrMessage

type InterfaceAddrMessage struct {
	Version int    // message version
	Type    int    // message type
	Flags   int    // interface flags
	Index   int    // interface index
	Addrs   []Addr // addresses
	// contains filtered or unexported fields
}

An InterfaceAddrMessage represents an interface address message.

type InterfaceMessage

type InterfaceMessage struct {
	Version int    // message version
	Type    int    // message type
	Flags   int    // interface flags
	Index   int    // interface index
	Name    string // interface name
	Addrs   []Addr // addresses
	// contains filtered or unexported fields
}

An InterfaceMessage represents an interface message.

func (*InterfaceMessage) MTU

func (m *InterfaceMessage) MTU() int

MTU returns the interface MTU.

type InterfaceMulticastAddrMessage

type InterfaceMulticastAddrMessage struct {
	Version int    // message version
	Type    int    // message type
	Flags   int    // interface flags
	Index   int    // interface index
	Addrs   []Addr // addresses
	// contains filtered or unexported fields
}

An InterfaceMulticastAddrMessage represents an interface multicast address message.

type LinkAddr

type LinkAddr struct {
	Index int    // interface index when attached
	Name  string // interface name when attached
	Addr  []byte // link-layer address when attached
}

A LinkAddr represents a link-layer address.

func (*LinkAddr) Family

func (a *LinkAddr) Family() int

Family implements the Family method of Addr interface.

type Message

type Message interface {
	// contains filtered or unexported methods
}

A Message represents a routing message.

func FetchRIBMessages

func FetchRIBMessages(typ, arg int) ([]Message, error)

FetchRIBMessages fetches a list of addressing messages for an interface. The typ argument is something like syscall.NET_RT_IFLIST. The argument is an interface index or 0 for all.

Jump to

Keyboard shortcuts

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