1 stable release

1.0.0+1.90.632-b035 Jun 23, 2021

#4 in #high-availability

21 downloads per month

LGPL-2.1+

42KB
1K SLoC

Copyright (C) 2021 Red Hat, Inc. All rights reserved.

Author: Christine Caulfield ccaulfie@redhat.com

This software licensed under GPL-2.0+

This crate contains Rust bindings for the libnozzle library, part of kornosnet: https://kronosnet.org/

libnozzle is a commodity library to manage tap (ethernet) interfaces


lib.rs:

This crate provides access to the kronosnet libraries libknet and libnozzle from Rust. They are a fairly thin layer around the actual API calls but with Rust data types and iterators.

No more information about knet itself will be provided here, it is expected that if you feel you need access to the knet API calls, you know what they do :)

Example

use nozzle_bindings::nozzle_bindings as nozzle; use std::io::{Result}; use std::env; use std::{thread, time};

fn main() -> Result<()> { let mut nozzle_name = String::from("rustnoz"); let handle = match nozzle::open(&mut nozzle_name, &String::from(env::current_dir().unwrap().to_str().unwrap())) { Ok(h) => { println!("Opened device {}", nozzle_name); h }, Err(e) => { println!("Error from open: {}", e); return Err(e); } };

 let if Err(e) = nozzle::add_ip(handle, &"192.160.100.1".to_string(), &"24".to_string()) {
     println!("Error from add_ip: {}", e);
     return Err(e);
 }

 let if Err(e) = nozzle::set_mtu(handle, 157) {
     println!("Error from set_mtu: {}", e);
     return Err(e);
 }

 Ok(())

}

Dependencies

~110–350KB