mrt

package
v0.0.0-...-6b8ee43 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MessageBridge messageBridge

MessageBridge implements registry.MessageCallback by forwarding to the active MRT Component. Registered as coordinator extra "mrt.messageCallback" so the BGP reactor factory can wire it during createReactorFromCoordinator. When no MRT config is active, OnBGPMessage returns immediately (nil check).

View Source
var PeerBridge peerBridge

PeerBridge implements registry.PeerLifecycleCallback by forwarding to the active MRT Component for FSM state change recording.

Functions

This section is empty.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component writes MRT dump files by subscribing to BGP events. Three independent streams: updates-only, all-messages, and periodic RIB snapshots. Implements reactor.MessageObserver for raw wire byte delivery.

func New

func New(cfg Config, logger *slog.Logger) *Component

New creates an MRT component with the given config.

func (*Component) OnBGPMessage

func (c *Component) OnBGPMessage(peer *plugin.PeerInfo, msgType msgtype.MessageType, sent bool, rawBytes []byte)

OnBGPMessage implements reactor.MessageObserver. Called synchronously on the session goroutine with raw wire bytes.

func (*Component) Start

func (c *Component) Start(bus ze.EventBus)

Start opens writers and subscribes to BGP state change events on the bus. Raw BGP messages arrive via OnBGPMessage (reactor.MessageObserver), not the bus.

func (*Component) Stop

func (c *Component) Stop()

Stop unsubscribes from events, stops the RIB dump loop, and closes all writers.

type Config

type Config struct {
	UpdatesPath     string        // strftime pattern for UPDATE-only stream
	UpdatesInterval time.Duration // file rotation interval for updates

	AllPath     string        // strftime pattern for all-messages stream
	AllInterval time.Duration // file rotation interval for all messages

	RoutesPath     string        // strftime pattern for periodic RIB snapshots
	RoutesInterval time.Duration // dump interval for TABLE_DUMP_V2

	ExtendedTimestamp bool // use BGP4MP_ET (type 17) instead of BGP4MP (type 16)
	AddPath           bool // force add-path subtypes even when not negotiated

	PeerFilter []string // if non-empty, only dump these peer addresses
	Direction  string   // "received", "sent", or "" for both
}

Config holds MRT dump configuration for the daemon component.

func ParseConfig

func ParseConfig(data json.RawMessage) (*Config, error)

ParseConfig parses MRT config from JSON section data.

The plugin server delivers a section wrapped in the config root, e.g. {"mrt":{"updates":{...}}} (BuildPluginConfigSections keys the body by root, as static/fib/etc. all unwrap). Unwrap the "mrt" key before decoding the body; a body that is already unwrapped (no "mrt" key) is decoded as-is.

func (*Config) HasAll

func (c *Config) HasAll() bool

HasAll reports whether the all-messages stream is configured.

func (*Config) HasRoutes

func (c *Config) HasRoutes() bool

HasRoutes reports whether periodic RIB dumps are configured.

func (*Config) HasUpdates

func (c *Config) HasUpdates() bool

HasUpdates reports whether the update stream is configured.

func (*Config) IsEmpty

func (c *Config) IsEmpty() bool

IsEmpty reports whether no dump streams are configured.

Directories

Path Synopsis
Package yang embeds and registers the MRT plugin's YANG configuration schema.
Package yang embeds and registers the MRT plugin's YANG configuration schema.

Jump to

Keyboard shortcuts

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