pub struct IpListenEndpoint {
pub addr: Option<Address>,
pub port: u16,
}Expand description
An internet endpoint address for listening.
In contrast with Endpoint, ListenEndpoint allows leaving the address
unspecified, in order to listen on a given port at more than one of our
addresses. The address field has three states, which are exactly the three
ways a bind can be scoped:
None: any address, of either IP version, a dual-stack bind.Some(addr)with an unspecified address (0.0.0.0/::): any address of that version, and none of the other one.Some(addr)with a concrete address: that address alone.
An endpoint can be constructed from a port alone, in which case the address
is None, and from an (address, port) pair, in which case it is Some. So
(Ipv4Address::UNSPECIFIED, 80) is the “any IPv4 address” bind, and
(Ipv6Address::UNSPECIFIED, 80) the IPv6 one.
Fields§
§addr: Option<Address>§port: u16Implementations§
Source§impl ListenEndpoint
impl ListenEndpoint
Sourcepub const UNSPECIFIED: ListenEndpoint
pub const UNSPECIFIED: ListenEndpoint
The fully wildcard endpoint: any address of any version, port zero.
Sourcepub fn concrete_addr(&self) -> Option<Address>
pub fn concrete_addr(&self) -> Option<Address>
The address, if it is a concrete one, neither absent nor unspecified. That is, one of our addresses rather than a filter over several.
Sourcepub fn version(&self) -> Option<Version>
pub fn version(&self) -> Option<Version>
The IP version this endpoint is restricted to, if it is restricted to one.
Sourcepub fn is_specified(&self) -> bool
pub fn is_specified(&self) -> bool
Query whether the endpoint names one concrete address and a nonzero port.
Trait Implementations§
Source§impl Clone for ListenEndpoint
impl Clone for ListenEndpoint
Source§fn clone(&self) -> ListenEndpoint
fn clone(&self) -> ListenEndpoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ListenEndpoint
Source§impl Debug for ListenEndpoint
impl Debug for ListenEndpoint
Source§impl Default for ListenEndpoint
impl Default for ListenEndpoint
Source§fn default() -> ListenEndpoint
fn default() -> ListenEndpoint
Source§impl Display for ListenEndpoint
impl Display for ListenEndpoint
impl Eq for ListenEndpoint
Source§impl<T: Into<Address>> From<(T, u16)> for ListenEndpoint
impl<T: Into<Address>> From<(T, u16)> for ListenEndpoint
Source§fn from((addr, port): (T, u16)) -> ListenEndpoint
fn from((addr, port): (T, u16)) -> ListenEndpoint
Source§impl From<Endpoint> for ListenEndpoint
impl From<Endpoint> for ListenEndpoint
Source§fn from(endpoint: Endpoint) -> ListenEndpoint
fn from(endpoint: Endpoint) -> ListenEndpoint
Source§impl From<SocketAddr> for ListenEndpoint
Available on crate features ipv4 and ipv6 only.
impl From<SocketAddr> for ListenEndpoint
ipv4 and ipv6 only.