pub mod builder;
mod config;
use builder::TorRelayBuilder;
use tor_rtcompat::Runtime;
#[cfg(all(feature = "rustls", any(feature = "async-std", feature = "tokio")))]
use tor_rtcompat::PreferredRuntime;
#[derive(Clone)]
pub struct TorRelay<R: Runtime> {
#[allow(unused)] runtime: R,
}
#[cfg(all(feature = "rustls", any(feature = "async-std", feature = "tokio")))]
impl TorRelay<PreferredRuntime> {
pub fn builder() -> TorRelayBuilder<PreferredRuntime> {
let runtime = PreferredRuntime::current().expect(
"TorRelay could not get an asynchronous runtime; are you running in the right context?",
);
TorRelayBuilder::new(runtime)
}
}
impl<R: Runtime> TorRelay<R> {
pub fn with_runtime(runtime: R) -> TorRelayBuilder<R> {
TorRelayBuilder::new(runtime)
}
pub(crate) fn create_inner(runtime: R) -> Self {
Self { runtime }
}
}