pub struct TransportConfig {
pub endpoint: EndpointType,
pub bind_mode: BindMode,
}Expand description
Transport endpoint configuration.
§Examples
use hyprstream_rpc::transport::TransportConfig;
// In-process endpoint
let inproc = TransportConfig::inproc("hyprstream/registry");Fields§
§endpoint: EndpointTypeEndpoint type (inproc, IPC, systemd FD)
bind_mode: BindModeSocket bind mode (Bind or Connect). Workers behind a ROUTER/DEALER load balancer use Connect.
Implementations§
Source§impl TransportConfig
impl TransportConfig
Sourcepub fn inproc(endpoint: impl Into<String>) -> Self
pub fn inproc(endpoint: impl Into<String>) -> Self
Create an in-process endpoint configuration.
Sourcepub fn ipc(path: impl Into<PathBuf>) -> Self
pub fn ipc(path: impl Into<PathBuf>) -> Self
Create an IPC (Unix domain socket) endpoint configuration.
Sourcepub fn systemd_fd(fd: RawFd, client_path: impl Into<PathBuf>) -> Self
pub fn systemd_fd(fd: RawFd, client_path: impl Into<PathBuf>) -> Self
Create a systemd socket activation endpoint.
§Arguments
fd- Pre-bound file descriptor from systemdclient_path- IPC path for client connections
Sourcepub fn quic(addr: SocketAddr, server_name: impl Into<String>) -> Self
pub fn quic(addr: SocketAddr, server_name: impl Into<String>) -> Self
Create a QUIC transport endpoint.
§Arguments
addr- Socket address to bind (server) or connect (client)server_name- Server hostname for TLS certificate validation
Sourcepub fn quic_pinned(
addr: SocketAddr,
server_name: impl Into<String>,
cert_hash: [u8; 32],
) -> Self
pub fn quic_pinned( addr: SocketAddr, server_name: impl Into<String>, cert_hash: [u8; 32], ) -> Self
Create a client QUIC endpoint that pins the server’s self-signed cert by
its SHA-256 fingerprint. This is the dial target the resolver/dial()
produce for an internal-mesh RPC peer (dialed by IP).
Sourcepub fn quic_with_auth(
addr: SocketAddr,
server_name: impl Into<String>,
auth: QuicServerAuth,
) -> Self
pub fn quic_with_auth( addr: SocketAddr, server_name: impl Into<String>, auth: QuicServerAuth, ) -> Self
Create a client QUIC endpoint with an explicit channel-auth policy (used by the DID-doc service-entry codec, which may produce any of WebPKI / Pinned / WebPKI+pin).
Sourcepub fn iroh(
node_id: [u8; 32],
direct_addrs: Vec<SocketAddr>,
relay_url: Option<String>,
) -> Self
pub fn iroh( node_id: [u8; 32], direct_addrs: Vec<SocketAddr>, relay_url: Option<String>, ) -> Self
Create a client iroh endpoint dialing the peer identified by node_id
(its EndpointId / Ed25519 public key), with optional direct addresses
and relay URL for NAT traversal.
Sourcepub fn with_connect_mode(self) -> Self
pub fn with_connect_mode(self) -> Self
Set bind mode to Connect (for workers behind a load balancer).
Sourcepub fn from_endpoint(endpoint: &str) -> Self
pub fn from_endpoint(endpoint: &str) -> Self
Parse an endpoint string into a TransportConfig.
Supports:
inproc://name→TransportConfig::Inprocipc:///path/to/socket→TransportConfig::Ipc
§Example
use hyprstream_rpc::transport::TransportConfig;
let config = TransportConfig::from_endpoint("inproc://hyprstream/registry");
assert_eq!(config.endpoint_string(), "inproc://hyprstream/registry");Sourcepub fn endpoint_string(&self) -> String
pub fn endpoint_string(&self) -> String
Get the endpoint string for this configuration.
For SystemdFd, returns the client IPC path.
For Quic, returns a descriptive string (not a connectable endpoint).
Sourcepub fn quic_webtransport_url(&self) -> Option<String>
pub fn quic_webtransport_url(&self) -> Option<String>
Get the WebTransport URL for QUIC endpoints.
Returns https://{server_name}:{port} for QUIC endpoints, None otherwise.
Sourcepub fn is_systemd_activated(&self) -> bool
pub fn is_systemd_activated(&self) -> bool
Check if this is a systemd-activated endpoint.
Sourcepub fn quic_resource_url(&self, path: &str) -> Option<String>
pub fn quic_resource_url(&self, path: &str) -> Option<String>
Build an RFC 9728 resource URL from a QUIC endpoint.
Returns https://{server_name}/{path}, matching the format used
by QuicSharedConfig::for_service(). The port is omitted because
resource URLs are identity tokens (used as JWT audience), not
connection endpoints — clients discover actual ports via the
endpoint registry.
Returns None if this is not a QUIC endpoint.
Trait Implementations§
Source§impl Clone for TransportConfig
impl Clone for TransportConfig
Source§fn clone(&self) -> TransportConfig
fn clone(&self) -> TransportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransportConfig
impl Debug for TransportConfig
Source§impl PartialEq for TransportConfig
impl PartialEq for TransportConfig
Source§fn eq(&self, other: &TransportConfig) -> bool
fn eq(&self, other: &TransportConfig) -> bool
self and other values to be equal, and is used by ==.impl Eq for TransportConfig
impl StructuralPartialEq for TransportConfig
Auto Trait Implementations§
impl Freeze for TransportConfig
impl RefUnwindSafe for TransportConfig
impl Send for TransportConfig
impl Sync for TransportConfig
impl Unpin for TransportConfig
impl UnsafeUnpin for TransportConfig
impl UnwindSafe for TransportConfig
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,
§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> 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