spiffe_rs/spiffetls/
mod.rs1mod dial;
2mod listen;
3mod mode;
4mod option;
5mod peerid;
6pub mod tlsconfig;
7
8pub use dial::{dial, dial_with_mode, ClientStream};
9pub use listen::{listen, listen_with_mode, Listener, ServerStream};
10pub use mode::*;
11pub use option::*;
12pub use peerid::{peer_id_from_stream, PeerIdGetter};
13
14#[derive(Debug, Clone)]
16pub struct Error(String);
17
18impl std::fmt::Display for Error {
19 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
20 self.0.fmt(f)
21 }
22}
23
24impl std::error::Error for Error {}
25
26pub type Result<T> = std::result::Result<T, Error>;
28
29fn wrap_error(message: impl std::fmt::Display) -> Error {
30 Error(format!("spiffetls: {}", message))
31}
32
33impl From<crate::workloadapi::Error> for Error {
34 fn from(err: crate::workloadapi::Error) -> Self {
35 Error(err.to_string())
36 }
37}