pub enum ChannelAddr {
Tcp(SocketAddr),
MetaTls(MetaTlsAddr),
Local(u64),
Sim(SimAddr),
Unix(SocketAddr),
Alias {
dial_to: Box<ChannelAddr>,
bind_to: Box<ChannelAddr>,
},
}Expand description
The type of a channel address, used to multiplex different underlying channel implementations. ChannelAddrs also have a concrete syntax: the address type (e.g., “tcp” or “local”), followed by “:”, and an address parseable to that type. For example:
tcp:127.0.0.1:1234- localhost port 1234 over TCPtcp:192.168.0.1:1111- 192.168.0.1 port 1111 over TCPlocal:123- the (in-process) local port 123unix:/some/path- the Unix socket at/some/path
Both local and TCP ports 0 are reserved to indicate “any available port” when serving.
let addr: ChannelAddr = "tcp:127.0.0.1:1234".parse().unwrap();
let ChannelAddr::Tcp(socket_addr) = addr else {
panic!()
};
assert_eq!(socket_addr.port(), 1234);
assert_eq!(socket_addr.is_ipv4(), true);Variants§
Tcp(SocketAddr)
A socket address used to establish TCP channels. Supports both IPv4 and IPv6 address / port pairs.
MetaTls(MetaTlsAddr)
An address to establish TCP channels with TLS support within Meta. Supports both hostname/port pairs (required for clients) and socket addresses (allowed for servers).
Local(u64)
Local addresses are registered in-process and given an integral index.
Sim(SimAddr)
Sim is a simulated channel for testing.
Unix(SocketAddr)
A unix domain socket address. Supports both absolute path names as well as “abstract” names per https://manpages.debian.org/unstable/manpages/unix.7.en.html#Abstract_sockets
Alias
A pair of addresses, one for the client and one for the server:
- The client should dial to the
dial_toaddress. - The server should bind to the
bind_toaddress.
The user is responsible for ensuring the traffic to the dial_to address
is routed to the bind_to address.
This is useful for scenarios where the network is configured in a way, that the bound address is not directly accessible from the client.
For example, in AWS, the client could be provided with the public IP address, yet the server is bound to a private IP address or simply INADDR_ANY. Traffic to the public IP address is mapped to the private IP address through network address translation (NAT).
Fields
dial_to: Box<ChannelAddr>The address to which the client should dial to.
bind_to: Box<ChannelAddr>The address to which the server should bind to.
Implementations§
Source§impl ChannelAddr
impl ChannelAddr
Sourcepub fn any(transport: ChannelTransport) -> Self
pub fn any(transport: ChannelTransport) -> Self
The “any” address for the given transport type. This is used to servers to “any” address.
Sourcepub fn transport(&self) -> ChannelTransport
pub fn transport(&self) -> ChannelTransport
The transport used by this address.
Source§impl ChannelAddr
impl ChannelAddr
Sourcepub fn from_zmq_url(address: &str) -> Result<Self, Error>
pub fn from_zmq_url(address: &str) -> Result<Self, Error>
Parse ZMQ-style URL format: scheme://address Supports:
- tcp://hostname:port or tcp://*:port (wildcard binding)
- inproc://endpoint-name (equivalent to local)
- ipc://path (equivalent to unix)
- metatls://hostname:port or metatls://*:port
- Alias format: dial_to_url@bind_to_url (e.g., tcp://host:port@tcp://host:port) Note: Alias format is currently only supported for TCP addresses
Trait Implementations§
Source§impl Clone for ChannelAddr
impl Clone for ChannelAddr
Source§fn clone(&self) -> ChannelAddr
fn clone(&self) -> ChannelAddr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChannelAddr
impl Debug for ChannelAddr
Source§impl<'de> Deserialize<'de> for ChannelAddr
impl<'de> Deserialize<'de> for ChannelAddr
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 Dispatcher<ChannelAddr> for SimDispatcher
impl Dispatcher<ChannelAddr> for SimDispatcher
Source§impl Display for ChannelAddr
impl Display for ChannelAddr
Source§impl From<ChannelAddr> for BindSpec
impl From<ChannelAddr> for BindSpec
Source§fn from(addr: ChannelAddr) -> Self
fn from(addr: ChannelAddr) -> Self
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§fn from(value: SocketAddr) -> Self
fn from(value: SocketAddr) -> Self
Source§impl From<SocketAddr> for ChannelAddr
impl From<SocketAddr> for ChannelAddr
Source§impl FromStr for ChannelAddr
impl FromStr for ChannelAddr
Source§impl Hash for ChannelAddr
impl Hash for ChannelAddr
Source§impl Named for ChannelAddr
impl Named for ChannelAddr
Source§fn typename() -> &'static str
fn typename() -> &'static str
Source§fn typehash() -> u64
fn typehash() -> u64
Source§fn arm(&self) -> Option<&'static str>
fn arm(&self) -> Option<&'static str>
Source§fn typeid() -> TypeId
fn typeid() -> TypeId
Source§impl Ord for ChannelAddr
impl Ord for ChannelAddr
Source§fn cmp(&self, other: &ChannelAddr) -> Ordering
fn cmp(&self, other: &ChannelAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for ChannelAddr
impl PartialEq for ChannelAddr
Source§impl PartialOrd for ChannelAddr
impl PartialOrd for ChannelAddr
Source§impl Serialize for ChannelAddr
impl Serialize for ChannelAddr
impl Eq for ChannelAddr
impl StructuralPartialEq for ChannelAddr
Auto Trait Implementations§
impl Freeze for ChannelAddr
impl RefUnwindSafe for ChannelAddr
impl Send for ChannelAddr
impl Sync for ChannelAddr
impl Unpin for ChannelAddr
impl UnwindSafe for ChannelAddr
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> Checkpointable for Twhere
T: RemoteMessage + Clone,
impl<T> Checkpointable for Twhere
T: RemoteMessage + Clone,
Source§type State = T
type State = T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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
§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<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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§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> 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 more