[][src]Crate rsef_rs

The rsef-rs crate provides functionality to download and parse RSEF listings.

Examples

Downloading and parsing an RSEF Listing

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

use rsef_rs::{Registry, Line, Reader, download};

fn main() {
    // Friday 1 February 2019 21:22:48
    let timestamp = 1549056168;
    let mut listing = download(Registry::RIPE, timestamp).unwrap();

    let mut reader = Reader{stream: listing};
    let records = reader.read_all().unwrap();

    for x in records {
        match x {
            Line::Version(x) => println!("Version: {:?}", x),
            Line::Summary(x) => println!("Summary: {:?}", x),
            Line::Record(x) => println!("Record: {:?}", x),
        }
    }
}

Structs

Reader

The BGPReader can read BGP messages from a BGP-formatted stream.

Record

Represents an record about either an ASN, IPv4 prefix or IPv6 prefix.

Summary

Represents an RSEF summary line.

Version

Represents an RSEF version line.

Enums

Line

Represents either a Version, Summary or Record line.

Registry

Represents a Regional Internet Registry (RIR).

Type

Represents the different number of Internet resource types.

Functions

download

Downloads the RSEF listings of a specific Regional Internet Registry at a specific moment. The timestamp should be an UNIX Epoch. Returns a decoded stream that can be read from.