pub struct Target { /* private fields */ }
Expand description
A target describes the TCP or Unix socket that a client will connect to, along with any optional TLS parameters.
Implementations§
Source§impl Target
impl Target
pub fn new(name: TargetName) -> Self
pub fn new_tls(name: TargetName, params: TlsParameters) -> Self
pub fn new_starttls(name: TargetName, params: TlsParameters) -> Self
pub fn new_resolved(target: ResolvedTarget) -> Self
pub fn new_resolved_tls(target: ResolvedTarget, params: TlsParameters) -> Self
pub fn new_resolved_starttls( target: ResolvedTarget, params: TlsParameters, ) -> Self
Sourcepub fn new_unix_path(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn new_unix_path(path: impl AsRef<Path>) -> Result<Self, Error>
Create a new target for a Unix socket.
Sourcepub fn new_unix_domain(domain: impl AsRef<[u8]>) -> Result<Self, Error>
pub fn new_unix_domain(domain: impl AsRef<[u8]>) -> Result<Self, Error>
Create a new target for a Unix socket.
Sourcepub fn new_tcp_tls(host: impl TcpResolve, params: TlsParameters) -> Self
pub fn new_tcp_tls(host: impl TcpResolve, params: TlsParameters) -> Self
Create a new target for a TCP socket with TLS.
Sourcepub fn new_tcp_starttls(host: impl TcpResolve, params: TlsParameters) -> Self
pub fn new_tcp_starttls(host: impl TcpResolve, params: TlsParameters) -> Self
Create a new target for a TCP socket with STARTTLS.
pub fn try_set_tls( &mut self, params: TlsParameters, ) -> Option<Option<Arc<TlsParameters>>>
pub fn try_remove_tls(&mut self) -> Option<Arc<TlsParameters>>
Sourcepub fn port(&self) -> Option<u16>
pub fn port(&self) -> Option<u16>
Get the port of the target. If the target type does not include a port, this will return None.
Sourcepub fn try_set_port(&mut self, port: u16) -> Option<u16>
pub fn try_set_port(&mut self, port: u16) -> Option<u16>
Set the port of the target. If the target type does not include a port, this will return None. Otherwise, it will return the old port.
Sourcepub fn path(&self) -> Option<&Path>
pub fn path(&self) -> Option<&Path>
Get the path of the target. If the target type does not include a path, this will return None.
Sourcepub fn host(&self) -> Option<Cow<'_, str>>
pub fn host(&self) -> Option<Cow<'_, str>>
Get the host of the target. For resolved IP addresses, this is the string representation of the IP address. For unresolved hostnames, this is the hostname. If the target type does not include a host, this will return None.
Sourcepub fn name(&self) -> Option<ServerName<'_>>
pub fn name(&self) -> Option<ServerName<'_>>
Get the name of the target. For resolved IP addresses, this is the string representation of the IP address. For unresolved hostnames, this is the hostname.