exa

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// parsing errors
	ErrEmptyLine        = errors.New("empty command")
	ErrInvalidFormat    = errors.New("invalid route command format")
	ErrInvalidAction    = errors.New("command must start with announce or withdraw")
	ErrOnlyRoute        = errors.New("only route commands supported")
	ErrMissingValue     = errors.New("parameter requires value")
	ErrInvalidPrefix    = errors.New("invalid prefix format")
	ErrInvalidNextHop   = errors.New("invalid next-hop IP address")
	ErrInvalidOrigin    = errors.New("invalid origin")
	ErrInvalidCommunity = errors.New("invalid community format")
)

Functions

func IsExaBytes

func IsExaBytes(line []byte) bool

IsExaBytes checks if the given byte slice looks like an ExaBGP command line. Requires at least 8 bytes to check for "announce" or "withdraw".

func IsExaString

func IsExaString(line string) bool

IsExaString checks if the given byte slice looks like an ExaBGP command line. Requires at least 8 bytes to check for "announce" or "withdraw".

Types

type Exa

type Exa struct {
	Str string   // parsed line (optional)
	Tok []string // all tokens in line (optional)

	Action    string   // announce or withdraw
	Prefix    string   // IP prefix (e.g., "10.0.0.1/24")
	NextHop   string   // next-hop IP address or "self"
	Origin    string   // IGP, EGP, INCOMPLETE (optional)
	ASPath    []uint32 // AS path sequence (optional)
	MED       *uint32  // Multi-Exit Discriminator (optional)
	LocalPref *uint32  // Local preference (optional)
	Community []string // Community values in brackets [no-export] or [123:456]
}

Exa represents an ExaBGP route announcement/withdrawal Focuses on the most commonly used attributes (80/20 approach)

func NewExa

func NewExa() *Exa

NewExa returns a new, empty Exa instance

func NewExaLine

func NewExaLine(line string) (*Exa, error)

NewExaLine creates a new Exa and parses the given command line

func (*Exa) IterMsg

func (x *Exa) IterMsg(m *msg.Msg) iter.Seq[*Exa]

IterMsg returns an iterator that converts bgpfix Msg (UPDATE) to Exa lines. For each reachable and unreachable prefix, it returns x after updating it.

func (*Exa) Parse

func (x *Exa) Parse(line string) error

ParseRoute parses an ExaBGP route command line Supports: - announce route <prefix> next-hop <ip|self> [origin <origin>] [as-path [asn...]] [med <value>] [local-preference <value>] [community [value...]] - withdraw route <prefix>

func (*Exa) Reset

func (x *Exa) Reset()

Reset clears all fields in Exa

func (*Exa) String

func (x *Exa) String() string

String converts Exa back to ExaBGP API format

func (*Exa) ToMsg

func (x *Exa) ToMsg(m *msg.Msg) error

ToMsg converts an Exa line r to a bgpfix Msg m.

Jump to

Keyboard shortcuts

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