speaker

package
v0.0.0-...-4712b44 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package speaker provides a very basic BGP speaker.

Index

Constants

This section is empty.

Variables

View Source
var (
	// seen a message that is too long
	EVENT_TOO_LONG = "bgpfix/speaker.TOO_LONG"

	// message parse error
	EVENT_PARSE_ERROR = "bgpfix/speaker.PARSE_ERROR"

	// remote hold timer expired
	// val[0] = nanoseconds till last R message
	EVENT_PEER_TIMEOUT = "bgpfix/speaker.PEER_TIMEOUT"
)
View Source
var DefaultOptions = Options{
	Logger:        &log.Logger,
	Passive:       true,
	LocalASN:      -1,
	LocalHoldTime: msg.OPEN_HOLDTIME,
	RemoteASN:     -1,
}

Default BGP speaker options

Functions

This section is empty.

Types

type Options

type Options struct {
	Logger *zerolog.Logger // if nil logging is disabled
	NewMsg func() *msg.Msg // optional source of new messages

	Passive   bool // if true, expect the peer to go first with OPEN
	ErrorDrop bool // drop erronous messages?

	LocalASN      int        // local ASN; -1 means use remote (if Passive)
	LocalHoldTime int        // local hold time (s); -1 means use a default
	LocalId       netip.Addr // local identifier; unspecified means use remote-1 (if Passive)
	LocalCaps     caps.Caps  // additional local capabilities; set to nil to block a capability

	RemoteASN      int        // expected remote ASN; -1 means accept any
	RemoteHoldTime int        // minimum remote hold time (s); <= 0 means any
	RemoteId       netip.Addr // expected remote identifier; unspecified means any
	RemoteCaps     caps.Caps  // minimum remote capabilities; set to nil to block a capability
}

Options are BGP speaker options, see also DefaultOptions

type Speaker

type Speaker struct {
	*zerolog.Logger

	Options Options // options; do not modify after Attach()
	// contains filtered or unexported fields
}

Speaker represents a basic BGP speaker for single-threaded use

func NewSpeaker

func NewSpeaker(ctx context.Context) *Speaker

NewSpeaker returns a new Speaker. Call Speaker.Attach() next.

func (*Speaker) Attach

func (s *Speaker) Attach(upstream *pipe.Direction) error

Attach attaches the speaker in given pipe direction. Must not be called more than once.

Jump to

Keyboard shortcuts

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