#![cfg_attr(docsrs, feature(doc_cfg))]
pub mod auth;
pub mod channel;
pub mod config;
pub mod errors;
pub mod events;
pub mod pusher;
pub mod token;
pub mod util;
pub mod webhook;
#[macro_use]
extern crate zeroize;
pub use channel::{Channel, ChannelName, ChannelType};
pub use config::{Config, ConfigBuilder};
pub use errors::{PusherError, RequestError, WebhookError};
pub use pusher::Pusher;
pub use token::Token;
pub use webhook::{Webhook, WebhookEvent};
pub type Result<T> = std::result::Result<T, PusherError>;
pub use auth::{SocketAuth, UserAuth};
pub use events::{BatchEvent, Event, TriggerParams};
pub const ENCRYPTION_AVAILABLE: bool = cfg!(feature = "encryption");
pub struct BuildInfo;
impl BuildInfo {
pub fn has_encryption() -> bool {
ENCRYPTION_AVAILABLE
}
pub fn tls_backend() -> &'static str {
if cfg!(feature = "rustls-tls") {
"rustls"
} else if cfg!(feature = "native-tls") {
"native-tls"
} else {
"none"
}
}
#[cfg(feature = "encryption")]
pub fn encryption_backend() -> &'static str {
if cfg!(feature = "sodiumoxide") {
"sodiumoxide"
} else {
"chacha20poly1305"
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_build_info() {
println!("Encryption available: {}", BuildInfo::has_encryption());
println!("TLS backend: {}", BuildInfo::tls_backend());
#[cfg(feature = "encryption")]
println!("Encryption backend: {}", BuildInfo::encryption_backend());
}
}