pub struct ServerInfo {
pub bind_addrs: Vec<Bindaddr>,
pub or_addr: Option<SocketAddr>,
pub extended_or_addr: Option<SocketAddr>,
pub auth_cookie_path: Option<String>,
}Expand description
Check the server pluggable transports environment, emitting an error message and returning a non-nil error if any error is encountered. Resolves the various requested bind addresses, the server ORPort and extended ORPort, and reads the auth cookie file. Returns a ServerInfo struct.
If your program needs to know whether to call ClientSetup or ServerSetup
(i.e., if the same program can be run as either a client or a server), check
whether the TOR_PT_CLIENT_TRANSPORTS environment variable is set:
match std::env::var_os("TOR_PT_CLIENT_TRANSPORTS") {
Some(_) => {
// Client mode; call pt.ClientSetup.
}
None => {
// Server mode; call pt.ServerSetup.
}
}Fields§
§bind_addrs: Vec<Bindaddr>§or_addr: Option<SocketAddr>§extended_or_addr: Option<SocketAddr>Implementations§
Source§impl ServerInfo
impl ServerInfo
pub async fn connect_to_or(&self) -> Result<TcpStream, Error>
Trait Implementations§
Source§impl Clone for ServerInfo
impl Clone for ServerInfo
Source§fn clone(&self) -> ServerInfo
fn clone(&self) -> ServerInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerInfo
impl Debug for ServerInfo
Source§impl Default for ServerInfo
impl Default for ServerInfo
Source§fn default() -> ServerInfo
fn default() -> ServerInfo
Returns the “default value” for a type. Read more
Source§impl PartialEq for ServerInfo
impl PartialEq for ServerInfo
impl StructuralPartialEq for ServerInfo
Auto Trait Implementations§
impl Freeze for ServerInfo
impl RefUnwindSafe for ServerInfo
impl Send for ServerInfo
impl Sync for ServerInfo
impl Unpin for ServerInfo
impl UnwindSafe for ServerInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more