pub struct RelayHandle { /* private fields */ }Expand description
Client-facing handle to the relay extension’s live engine: open local tunnels and register
local services. This is the relay extension’s own surface — the relay owns its engine and
installs itself (install), so nothing about it leaks into the
generic Provider.
Cloneable; every clone drives the same shared engine and pure Relay state.
Holds the two per-namespace scoped capabilities (tcp / udp); each method picks one and
can only act within it, so the handle cannot address an arbitrary namespace even internally.
Implementations§
Source§impl RelayHandle
impl RelayHandle
Sourcepub fn install(extensions: &Extensions) -> Result<Self>
pub fn install(extensions: &Extensions) -> Result<Self>
Install the relay into an extension registry: register the TCP and UDP interpreters
over a fresh, relay-owned OS-socket engine and return the client handle. Errors if the
tcp/udp namespaces are already taken. Call once per node, after constructing the
provider — the relay is opt-in, not a Provider invariant.
Sourcepub async fn open_tcp_tunnel(
&self,
local_addr: SocketAddr,
peer: Did,
service: String,
) -> Result<()>
pub async fn open_tcp_tunnel( &self, local_addr: SocketAddr, peer: Did, service: String, ) -> Result<()>
Open a local TCP tunnel: bind local_addr and relay each accepted connection to
peer’s service (client side, forward proxy).
Sourcepub async fn relay_tcp_stream(
&self,
stream: TcpStream,
peer: Did,
service: String,
) -> Result<()>
pub async fn relay_tcp_stream( &self, stream: TcpStream, peer: Did, service: String, ) -> Result<()>
Relay one already-accepted TCP stream to peer’s service.
Sourcepub async fn open_udp_tunnel(
&self,
local_addr: SocketAddr,
peer: Did,
service: String,
) -> Result<()>
pub async fn open_udp_tunnel( &self, local_addr: SocketAddr, peer: Did, service: String, ) -> Result<()>
Open a local UDP tunnel: bind local_addr and relay each datagram flow to peer’s
service (client side, forward proxy).
Sourcepub async fn register_tcp_service(
&self,
name: String,
addr: SocketAddr,
) -> Result<()>
pub async fn register_tcp_service( &self, name: String, addr: SocketAddr, ) -> Result<()>
Register (at runtime) a local service the TCP relay may dial (name → addr).
Sourcepub async fn register_udp_service(
&self,
name: String,
addr: SocketAddr,
) -> Result<()>
pub async fn register_udp_service( &self, name: String, addr: SocketAddr, ) -> Result<()>
Register (at runtime) a local service the UDP relay may dial (name → addr).
Trait Implementations§
Source§impl Clone for RelayHandle
impl Clone for RelayHandle
Source§fn clone(&self) -> RelayHandle
fn clone(&self) -> RelayHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RelayHandle
impl !UnwindSafe for RelayHandle
impl Freeze for RelayHandle
impl Send for RelayHandle
impl Sync for RelayHandle
impl Unpin for RelayHandle
impl UnsafeUnpin for RelayHandle
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for T
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.