Skip to content

PalSubham/rsvici

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%