Documentation
¶
Overview ¶
Package bird provides a client for communicating with a BIRD routing daemon using Unix domain sockets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptySock = errors.New("empty sock")
ErrEmptySock is returned when attempting to send a message using an uninitialized socket.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for communicating with the BIRD routing daemon. It manages Unix domain sockets for sending and receiving messages.
func NewClient ¶
func NewClient(sockDir, sockNamePrefix string, opts ...ClientOption) (*Client, error)
NewClient creates a new Client with the specified socket directory and name prefix. The client listens and sends messages using Unix domain sockets. Additional options can be provided using the ClientOption functions.
func (*Client) ListenRequest ¶
ListenRequest listens for an incoming request on the client's socket. This is a blocking call that waits for a message to be received.
func (*Client) Send ¶
Send sends a single Message to the BIRD daemon. The message is serialized using BigEndian byte order before sending.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures a Client.
func WithBatchSize ¶
func WithBatchSize(size uint) ClientOption
WithBatchSize is a ClientOption that sets the batch size for the Client.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a message sent to the BIRD daemon. It contains information about the IP version, address, prefix length, and status.
func NewMessage ¶
func NewMessage(prefix netip.Prefix, status PrefixStatus) Message
NewMessage creates a new Message with the given network prefix and status. It automatically determines the IP version based on the prefix and sets the appropriate fields.
type PrefixStatus ¶
type PrefixStatus byte
PrefixStatus represents the status of a network prefix, either enabled or disabled.
const ( // Enable indicates that the prefix should be enabled. Enable PrefixStatus = 0x01 // Disable indicates that the prefix should be disabled. Disable PrefixStatus = 0x00 )