IPSet

Build Status GitHub issues GitHub license Releases

A library wrapper for libipset.
Support the following commands:

Support the following type:

Example

```rust use std::net::IpAddr;

use ipset::{Error, HashIp, Session};

fn main() -> Result<(), Error> { let mut session: Session = Session::::new("test".tostring()); let ip: IpAddr = "192.168.3.1".parse().unwrap(); session.create(|builder| builder.withipv6(false)?.build())?;

let ret = session.add(ip)?;
println!("add {}", ret);

let exists = session.test(ip)?;
println!("test {}", exists);

let ips = session.list()?;
for ip in ips {
    println!("list {}", ip);
}

let ret = session.del(ip)?;
println!("del {}", ret);

let ret = session.flush()?;
println!("flush {}", ret);

let ret = session.destroy()?;
println!("destroy {}", ret);

Ok(())

} ```