openvpn-plugin is a crate that makes it easy to write OpenVPN plugins in Rust.
The crate contains two main things:
- The
openvpn_plugin!macro for generating the FFI interface OpenVPN will interact with - The FFI and safe Rust types needed to communicate with OpenVPN.
Usage
Edit your Cargo.toml to depend on this crate and set the type of your crate to a cdylib in
order to make it compile to a shared library that OpenVPN will understand:
[]
= ["cdylib"]
[]
= "0.1"
Import the crate, including macros, in your crate root (lib.rs):
extern crate openvpn_plugin;
Also in your crate root (lib.rs) define your handle type, the three callback functions and
call the openvpn_plugin! macro to generate the corresponding FFI bindings.
More details on the handle and the callback functions can be found in the documentation for the
openvpn_plugin! macro.
openvpn_plugin!;