7 releases

0.1.0 Feb 18, 2024
0.1.0-rc.7 Feb 15, 2024
0.1.0-rc.6 Aug 29, 2023
0.1.0-rc.5 May 14, 2023
0.1.0-rc.2 Aug 28, 2021

#6 in #route


Used in 2 crates (via bgpfu-lib)

MIT license

62KB
1.5K SLoC

irrc-rs

Crates.io ci/cd codecov docs.rs

About

A Rust library crate irrc, providing a client implementation of the IRRd query protocol.


lib.rs:

This crate provides a client implementation of the IRRd query protocol.

The implementation provides pipelined query execution for maximal performance over a single TCP connection.

Quickstart

use irrc::{IrrClient, Query, Error};
use rpsl::names::AutNum;

fn main() -> Result<(), Error> {

    let mut irr = IrrClient::new("whois.radb.net:43")
        .connect()?;

    println!("connected to {}", irr.version()?);

    let as_set = "AS-FOO".parse().unwrap();
    println!("getting members of {}", as_set);
    irr.pipeline()
        .push(Query::AsSetMembersRecursive(as_set))?
        .responses::<AutNum>()
        .filter_map(|result| {
            result.map_err(|err| {
                println!("error parsing member: {}", err);
                err
            })
            .ok()
        })
        .for_each(|autnum| println!("{}", autnum.content()));

    Ok(())
}

Dependencies

~16MB
~137K SLoC