Skip to main content

Crate bgpflux

Crate bgpflux 

Source
Expand description

§bgpflux

A Rust library and CLI for streaming ordered BGP elements from multiple route collectors.

bgpflux merges BGP data from RIPE RIS and RouteViews collectors in chronological order, supporting both historical archives and real-time feeds.

§Features

  • Archive & Live streaming: Historical data via BGPKIT Broker, real-time data via RIS Live (WebSocket) and RouteViews Live (Kafka)
  • Sorted output: Elements from multiple collectors are merged in timestamp order
  • Filtering: Origin ASN, prefix, peer IP/ASN, AS path regex, community, IP version
  • Caching: Optional local file caching to skip re-downloading archive data
  • Jitter buffer: Reorder live stream elements with a configurable delay window

§Quick Start — Archive

use bgpflux::{BgpStream, BgpStreamConfig, DataType};

let config = BgpStreamConfig::new(
    "2025-01-15T12:00:00Z",
    "2025-01-15T13:00:00Z",
    &["route-views.wide", "rrc04"],
    DataType::Update,
)?;

let stream = BgpStream::new(config).build();

for elem in stream {
    println!("{}", elem);
}

§Quick Start — Live (requires live feature)

use bgpflux::{LiveBgpStream, LiveConfig, JitterBufferExt};
use std::time::Duration;

let config = LiveConfig::new(&["rrc00", "route-views2"])?;
let stream = LiveBgpStream::new(config)
    .build()
    .jitter_buffer(Duration::from_secs(15));

for elem in stream {
    println!("{}", elem);
}

§Core Components

  • BgpStream: Streams historical BGP data from archives
  • BgpStreamConfig: Configuration for archive streams (time range, collectors, data type)
  • BgpStreamElem: A single BGP element with collector metadata

With the live feature enabled:

  • LiveBgpStream: Streams real-time BGP data from RIS Live and RouteViews Live
  • LiveConfig: Configuration for live streams (collectors)
  • JitterBufferExt: Extension trait to reorder live stream elements by timestamp

§Acknowledgments

This project uses code copied or adapted from:

Re-exports§

pub use config::BgpStreamConfig;
pub use config::DataType;
pub use elem::BgpStreamElem;
pub use elem::BgpStreamElemType;

Modules§

config
elem
runtime

Structs§

BgpStream
The main streaming interface for BGP elements from multiple collectors.