1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
mod error;
#[cfg(not(feature = "reqwest-connector"))]
mod null_connector;
#[cfg(feature = "reqwest-connector")]
mod reqwest_connector;
mod status;
use failure::Error;
pub use self::error::ConnectorError;
#[cfg(not(feature = "reqwest-connector"))]
pub use self::null_connector::NullConnector;
#[cfg(feature = "reqwest-connector")]
pub use self::reqwest_connector::ReqwestConnector;
pub use self::status::Status;
#[cfg(feature = "reqwest-connector")]
pub type DefaultConnector = ReqwestConnector;
#[cfg(not(feature = "reqwest-connector"))]
pub type DefaultConnector = NullConnector;
pub const USER_AGENT: &str = concat!("yubihsm.rs ", env!("CARGO_PKG_VERSION"));
pub trait Connector: Sized + Send {
fn open(connector_url: &str) -> Result<Self, Error>;
fn status(&self) -> Result<Status, Error>;
fn send_command(&self, cmd: Vec<u8>) -> Result<Vec<u8>, Error>;
}