pub struct IpsetSys { /* private fields */ }Implementations§
Source§impl IpsetSys
impl IpsetSys
Sourcepub fn init() -> Result<IpsetSys, IpsetSysError>
pub fn init() -> Result<IpsetSys, IpsetSysError>
init ipset handler. will fail upon unsufficient rights, or lacking library.
Sourcepub fn run(&mut self, cmd: &str) -> Result<(), IpsetSysError>
pub fn run(&mut self, cmd: &str) -> Result<(), IpsetSysError>
normal libipset command handler. parses string commands as directed by CLI
see man ipset for more details
§Example
let mut is = ipset_sys::IpsetSys::init().unwrap();
is.run("create bob hash:ip timeout 3600").unwrap();
is.run("add bob 1.4.4.4").unwrap();Sourcepub fn add_v4(
&mut self,
set: &str,
target: Ipv4Addr,
) -> Result<(), IpsetSysError>
pub fn add_v4( &mut self, set: &str, target: Ipv4Addr, ) -> Result<(), IpsetSysError>
custom ipset command to add an ipv4 to a given set. this command directly issues ipset commands without going through the CLI parser, etc…
§Example
let mut is = ipset_sys::IpsetSys::init().unwrap();
let addr = Ipv4Addr::new(1, 4, 4, 4);
is.add_v4("bob", addr).unwrap();Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpsetSys
impl RefUnwindSafe for IpsetSys
impl !Send for IpsetSys
impl !Sync for IpsetSys
impl Unpin for IpsetSys
impl UnwindSafe for IpsetSys
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more