package routebsd

import "internal/routebsd"

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

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.

Source Files

address.go binary.go interface.go interface_classic.go interface_multicast.go message.go route.go sys.go sys_darwin.go

Version
v1.25.0-rc.1
Published
Jun 11, 2025
Platform
darwin/amd64
Imports
6 packages
Last checked
3 minutes ago

Tools for package owners.