2 releases

0.1.1 Apr 10, 2022
0.1.0 Apr 3, 2022

#12 in #configure

Download history 6/week @ 2023-12-20 6/week @ 2023-12-27 2/week @ 2024-01-03 12/week @ 2024-01-17 11/week @ 2024-01-24 14/week @ 2024-01-31 11/week @ 2024-02-14 27/week @ 2024-02-21 24/week @ 2024-02-28 26/week @ 2024-03-06 18/week @ 2024-03-13

97 downloads per month

MIT license

41KB
645 lines

rsvici

The rsvici is a client library to configure, control, and monitor the IKE daemon charon using the VICI protocol. All the features are implemented on top of the Tokio runtime to asynchronously interact with charon.

Dependency

[dependencies]
rsvici = "0.1"

Basic Usage

  1. Refer to Client-initiated commands and Server-issued events.
  2. Define structs for the request and response.
  3. Connect to the IKE daemon either over a Unix socket or a TCP connection.
use std::error::Error;

use serde::Deserialize;

#[derive(Debug, Deserialize)]
struct Version {
    daemon: String,
    version: String,
    sysname: String,
    release: String,
    machine: String,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let mut client = rsvici::unix::connect("/run/charon.vici").await?;

    let version: Version = client.request("version", ()).await?;
    println!("Version: {:#?}", version);

    Ok(())
}

Hints on serializing/deserializing

The serialization/deserialization implementation has certain behaviors specific to the VICI protocol:

  • bool values are serialized to or deserialized from "yes" or "no".
  • Sections with zero-based index are serialized to or deserialized from Vec<T>.

Dependencies

~5–16MB
~178K SLoC