wireguard_uapi/linux/err/
connect_error.rs

1use neli::consts::{
2    genl::{CtrlAttr, CtrlCmd},
3    nl::GenlId,
4};
5use neli::err::NlError;
6use neli::genl::Genlmsghdr;
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum ConnectError {
11    #[error(transparent)]
12    NlError(NlError),
13
14    #[error("Unable to connect to the WireGuard DKMS. Is WireGuard installed?")]
15    ResolveFamilyError(#[source] NlError<GenlId, Genlmsghdr<CtrlCmd, CtrlAttr>>),
16}
17
18impl From<NlError> for ConnectError {
19    fn from(error: NlError) -> Self {
20        ConnectError::NlError(error)
21    }
22}
23
24impl From<std::io::Error> for ConnectError {
25    fn from(error: std::io::Error) -> Self {
26        ConnectError::NlError(error.into())
27    }
28}