libknot 0.2.3

High Level bindings to a subset of libknot, the library of the knot dns server
Documentation
extern crate libknot;

#[cfg(feature = "native")]
use libknot::native::MessageBuilder;
#[cfg(feature = "native")]
use crate::libknot::KnotSync;
#[cfg(feature = "native")]
use std::time::Duration;

#[cfg(feature = "native")]
fn main() -> libknot::error::Result<()> {
    let mut knotc = libknot::native::Control::new("/run/knot/knot.sock")?;

    knotc.set_timeout(Some(Duration::from_secs(2)));

    /*let mut msg = libknot::control::ControlMessage::new();
    msg.set(sys::knot_ctl_idx_t::KNOT_CTL_IDX_CMD, Some("conf-get"))?;
    msg.set(sys::knot_ctl_idx_t::KNOT_CTL_IDX_SECTION, Some("zone"))?;*/

    knotc.conf_transaction(|knotc| {
        let msg = MessageBuilder::new().cmd("conf-get").build();

        for el in knotc.send_request(&msg)? {
            println!("{:#?}", el);
        }

        knotc.conf_set("zone", Some("zone.dynmaic"), None, None)?;
        knotc.conf_set(
            "zone",
            Some("zone.dynmaic"),
            Some("file"),
            Some("zone.dynamic.zone"),
        )?;
        libknot::error::Result::Ok(())
    })?;

    /*
    loop {
        let (ty, msg) = knotc.recv_single_message()?;

        println!("Type: {}, Msg: {:#?}", ty, msg);
    }*/

    Ok(())
}

#[cfg(not(feature = "native"))]
fn main() {}