Skip to content

nuclearcat/mrt-ingester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mrt_ingester

High-performance parser for MRT (Multi-threaded Routing Toolkit) routing data files.

Overview

This library parses MRT-formatted binary streams containing BGP routing information, as specified in RFC 6396 and RFC 8050.

Features

  • Full support for all MRT record types defined in RFC 6396
  • BGP Add-Path extensions (RFC 8050)
  • Zero-copy design where possible
  • API-compatible with the original mrt-rs crate

Supported Record Types

Type Name Description
5 BGP Legacy BGP records (IPv4, 16-bit ASN)
6 RIP RIP protocol records
8 RIPNG RIPng protocol records
9-10 BGP4PLUS Legacy BGP records (IPv6, 16-bit ASN)
11 OSPFv2 OSPFv2 protocol records
12 TABLE_DUMP RIB dump (one entry per record)
13 TABLE_DUMP_V2 RIB dump v2 (multiple entries per record)
16-17 BGP4MP Modern BGP records (IPv4/IPv6, 16/32-bit ASN)
32-33 ISIS IS-IS protocol records
48-49 OSPFv3 OSPFv3 protocol records

Usage

use std::fs::File;
use std::io::BufReader;

fn main() -> std::io::Result<()> {
    let file = File::open("updates.mrt")?;
    let mut reader = BufReader::new(file);

    while let Some((header, record)) = mrt_ingester::read(&mut reader)? {
        println!("Timestamp: {}, Type: {}", header.timestamp, header.record_type);

        match record {
            mrt_ingester::Record::BGP4MP(bgp4mp) => {
                // Handle BGP4MP record
            }
            mrt_ingester::Record::TABLE_DUMP_V2(table_dump) => {
                // Handle TABLE_DUMP_V2 record
            }
            _ => {}
        }
    }

    Ok(())
}

Data Sources

MRT files are available from:

License

Licensed under either of:

at your option.

References

  • RFC 6396 - MRT Routing Information Export Format
  • RFC 8050 - MRT with BGP Additional Path Extensions

About

MRT file parser

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages