pub struct HostEndpoint { /* private fields */ }Expand description
A TCP endpoint resolved afresh for each connect or bind. Connection attempts follow resolver order; binding creates a listener for every resolved address. There is no cache or background resolver task.
Implementations§
Source§impl HostEndpoint
impl HostEndpoint
Sourcepub fn new(hostname: impl Into<String>, port: u16) -> Self
pub fn new(hostname: impl Into<String>, port: u16) -> Self
Describe a TCP hostname and numeric port. Pass an unbracketed hostname or IP literal without a port.
Sourcepub const fn wildcard(port: u16) -> Self
pub const fn wildcard(port: u16) -> Self
Describe all local interfaces for binding. When connecting, an absent hostname selects loopback addresses according to the resolver’s contract.
Sourcepub fn with_domain(self, domain: SocketDomain) -> Self
pub fn with_domain(self, domain: SocketDomain) -> Self
Restrict resolution to the selected IP family. By default both families are eligible.
Sourcepub fn hostname(&self) -> Option<&str>
pub fn hostname(&self) -> Option<&str>
The configured hostname, or None for wildcard binding and loopback connecting.
Sourcepub async fn resolve<S: AddressResolution + ?Sized>(
&self,
scheduler: &S,
passive: bool,
cancellation: &Cancellation,
) -> OperationResult<Vec<AddressEndpoint>>
pub async fn resolve<S: AddressResolution + ?Sized>( &self, scheduler: &S, passive: bool, cancellation: &Cancellation, ) -> OperationResult<Vec<AddressEndpoint>>
Resolve to numeric TCP endpoints, preserving order and duplicates. passive selects wildcard addresses for an absent hostname; otherwise an absent hostname selects loopback. Empty results are preserved here and rejected by connect/bind.