Expand description
A library for writing CNI plugins in Rust.
This crate is the plugin side of CNI: the process a container runtime invokes.
For the calling side, see rscni-runtime (planned).
Write a type that implements the Cni trait, then pass it to Plugin::run.
Plugin::run reads the CNI_* environment variables and stdin, calls the method for
the requested operation, and writes the result. Both Cni and Plugin are in the
cni module. The async_cni module has async versions of both, behind the
async feature.
The specification types both sides exchange live in
rscni-types and are re-exported here, so
rscni_plugin::types::NetConf and rscni_types::types::NetConf are the same type.
Complete examples: rscni-debug and async-rscni-debug.
§Quick start
let my_plugin = MyPlugin;
let plugin = Plugin::default();
plugin.run(&my_plugin).expect("Failed to run CNI plugin");