pub struct ListenAddress {
pub protocol: Protocol,
pub address: Option<IpAddr>,
pub port: Option<u16>,
}
Expand description
A listener’s address, with the protocol, ip address, and port.
§String representation
A ListenAddress
can be represented as a string in the format
protocol:ip-address:port
.
The protocol is the string representation of a links-supported Protocol
(see its documentation for more info). The protocol is case-insensitive and
can not be omitted.
The ip address is an IPv4 address literal (e.g. 0.0.0.0
, 127.0.0.1
, or
198.51.100.35
), an IPv6 address literal in square brackets (e.g. [::]
,
[::1]
, or [2001:db8:6ca1:573d:15c7:075f:5de5:cd30]
), or can be omitted.
The listener will listen for incoming connections on the specified address.
Address 0.0.0.0
can be used to listen on all IPv4 (but not IPv6)
addresses, address [::]
can be used to listen on all IPv6 (but not IPv4)
addresses. An empty (omitted) address can be used to listen on all
addresses, IPv4 and IPv6, though this requires OS support for dual stack
sockets (which is common but not universal). In the case of lack of such
support, an empty address is equivalent to [::]
, and as such will listen
on all IPv6 (but not IPv4) addresses.
The port is a TCP/UDP port (currently only TCP is used, but UDP may be used
in the future for some protocols). An empty (omitted) port means the default
port for the specified protocol (see Protocol
). Port 0
can be used to
request and ephemeral port from the operating system, however this is not
recommended for server applications such as links.
Fields§
§protocol: Protocol
The protocol that the listener will process. See Protocol
for
details.
address: Option<IpAddr>
The address of the listener. An unspecified (omitted) address will
listen on all addresses (OS support is not universal, see
ListenAddress
).
port: Option<u16>
The port (TCP and UDP) that the listener will use. An unspecified port means the default port of the protocol.
Trait Implementations§
Source§impl Clone for ListenAddress
impl Clone for ListenAddress
Source§fn clone(&self) -> ListenAddress
fn clone(&self) -> ListenAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ListenAddress
impl Debug for ListenAddress
Source§impl<'de> Deserialize<'de> for ListenAddress
impl<'de> Deserialize<'de> for ListenAddress
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ListenAddress
impl Display for ListenAddress
Source§impl From<ListenAddress> for String
impl From<ListenAddress> for String
Source§fn from(address: ListenAddress) -> Self
fn from(address: ListenAddress) -> Self
Source§impl FromStr for ListenAddress
impl FromStr for ListenAddress
Source§impl PartialEq for ListenAddress
impl PartialEq for ListenAddress
Source§impl Serialize for ListenAddress
impl Serialize for ListenAddress
Source§impl TryFrom<&str> for ListenAddress
impl TryFrom<&str> for ListenAddress
impl Copy for ListenAddress
impl Eq for ListenAddress
Auto Trait Implementations§
impl Freeze for ListenAddress
impl RefUnwindSafe for ListenAddress
impl Send for ListenAddress
impl Sync for ListenAddress
impl Unpin for ListenAddress
impl UnwindSafe for ListenAddress
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request