Function load_from_path

Source
pub unsafe fn load_from_path<P>(path: P) -> Result<Wireguard, Error>
where P: AsRef<OsStr>,
Expand description

Attempts to load the wireguard library as a dynamic library from the given path.

§Safety

This function loads a dll file with the path provided. This is inherently unsafe as a user could simply rename undefined_behavior.dll to wireguard.dll and do nefarious things inside of its DllMain function. In most cases, a regular wireguard.dll file which exports all of the required functions for these bindings to work is loaded. Because WireGuard NT is a well-written and well-tested library, loading a normal wireguard.dll file should be safe. Hoverer one can never be too cautious when loading a dll file.

For more information see libloading’s dynamic library safety guarantees: libloading