Struct ConnectUdpSocket
pub struct ConnectUdpSocket<T = Upgraded> { /* private fields */ }masque only.Expand description
A DatagramSocket carrying UDP payloads through a CONNECT-UDP tunnel (RFC 9298).
Wraps the HttpDatagramSession of an accepted tunnel on any HTTP version, so a QUIC
endpoint, a relay or a proxy can use the tunnel as a UDP socket fixed to one peer.
Payloads travel with Context ID 0; datagrams for other contexts are dropped and
counted. Sending never waits for delivery, but a full queue applies backpressure
(Pending) instead of dropping older payloads. Native HTTP/3 payloads above the
current limit are dropped and counted, never re-sent as capsules (RFC 9298 §6.1).
Implementations§
§impl<T> ConnectUdpSocket<T>where
T: AsyncRead + AsyncWrite + ExtensionsRef + Send + 'static,
impl<T> ConnectUdpSocket<T>where
T: AsyncRead + AsyncWrite + ExtensionsRef + Send + 'static,
pub fn new(
exec: &Executor,
session: HttpDatagramSession<T>,
local: SocketAddress,
peer: SocketAddress,
config: ConnectUdpSocketConfig,
) -> ConnectUdpSocket<T>
pub fn new( exec: &Executor, session: HttpDatagramSession<T>, local: SocketAddress, peer: SocketAddress, config: ConnectUdpSocketConfig, ) -> ConnectUdpSocket<T>
Turn an established tunnel’s session into a socket fixed to peer.
Build the session with session_config.
local and peer are what Socket reports: the target’s address on the
client side, the client’s or a documented placeholder on the proxy side.
IPv4-mapped IPv6 addresses are reported as IPv4.
§impl<T> ConnectUdpSocket<T>
impl<T> ConnectUdpSocket<T>
pub fn close_reason(&self) -> Option<ConnectUdpClose>
pub fn close_reason(&self) -> Option<ConnectUdpClose>
Why the tunnel stopped, once it did.
pub fn max_payload(&self) -> usize
pub fn max_payload(&self) -> usize
The largest UDP payload that can be sent now: the native datagram limit minus the Context ID, or the RFC 9298 maximum on capsule carriers.
Trait Implementations§
§impl<T> DatagramSocket for ConnectUdpSocket<T>where
T: AsyncRead + Send + 'static,
impl<T> DatagramSocket for ConnectUdpSocket<T>where
T: AsyncRead + Send + 'static,
§type Sender = ConnectUdpSender
type Sender = ConnectUdpSender
§fn create_sender(&self) -> <ConnectUdpSocket<T> as DatagramSocket>::Sender
fn create_sender(&self) -> <ConnectUdpSocket<T> as DatagramSocket>::Sender
§fn poll_recv(
&mut self,
cx: &mut Context<'_>,
buffers: &mut [IoSliceMut<'_>],
metadata: &mut [DatagramMetadata],
) -> Poll<Result<usize, DatagramError>>
fn poll_recv( &mut self, cx: &mut Context<'_>, buffers: &mut [IoSliceMut<'_>], metadata: &mut [DatagramMetadata], ) -> Poll<Result<usize, DatagramError>>
§fn capabilities(&self) -> DatagramCapabilities
fn capabilities(&self) -> DatagramCapabilities
§impl<T> Debug for ConnectUdpSocket<T>
impl<T> Debug for ConnectUdpSocket<T>
§impl<T> ExtensionsRef for ConnectUdpSocket<T>
impl<T> ExtensionsRef for ConnectUdpSocket<T>
§fn extensions(&self) -> &Extensions
fn extensions(&self) -> &Extensions
Extensions store§impl<T> Socket for ConnectUdpSocket<T>where
T: Send + 'static,
impl<T> Socket for ConnectUdpSocket<T>where
T: Send + 'static,
§fn local_addr(&self) -> Result<SocketAddress, Error>
fn local_addr(&self) -> Result<SocketAddress, Error>
§fn peer_addr(&self) -> Result<SocketAddress, Error>
fn peer_addr(&self) -> Result<SocketAddress, Error>
Auto Trait Implementations§
impl<T = Upgraded> !Freeze for ConnectUdpSocket<T>
impl<T = Upgraded> !RefUnwindSafe for ConnectUdpSocket<T>
impl<T = Upgraded> !UnwindSafe for ConnectUdpSocket<T>
impl<T> Send for ConnectUdpSocket<T>where
SessionReceiver<T>: Send,
impl<T> Sync for ConnectUdpSocket<T>where
SessionReceiver<T>: Sync,
impl<T> Unpin for ConnectUdpSocket<T>where
SessionReceiver<T>: Unpin,
impl<T> UnsafeUnpin for ConnectUdpSocket<T>where
SessionReceiver<T>: UnsafeUnpin,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<S> DatagramBridgeInput for S
impl<S> DatagramBridgeInput for S
§fn ingress(&self) -> &<S as DatagramBridgeInput>::Ingress
fn ingress(&self) -> &<S as DatagramBridgeInput>::Ingress
§fn bridge<Egress>(
self,
egress: Egress,
) -> <S as DatagramBridgeInput>::Bridged<Egress>where
Egress: Send + 'static,
fn bridge<Egress>(
self,
egress: Egress,
) -> <S as DatagramBridgeInput>::Bridged<Egress>where
Egress: Send + 'static,
egress next to its ingress.§impl<S> DatagramPeekInput for Swhere
S: DatagramSocket,
impl<S> DatagramPeekInput for Swhere
S: DatagramSocket,
§type Mapped<Peeked: DatagramSocket> = Peeked
type Mapped<Peeked: DatagramSocket> = Peeked
PrefixedDatagramSocket.§fn peek_socket_mut(&mut self) -> &mut <S as DatagramPeekInput>::Socket
fn peek_socket_mut(&mut self) -> &mut <S as DatagramPeekInput>::Socket
§fn map_peek_socket<Peeked, F>(
self,
map: F,
) -> <S as DatagramPeekInput>::Mapped<Peeked>
fn map_peek_socket<Peeked, F>( self, map: F, ) -> <S as DatagramPeekInput>::Mapped<Peeked>
map’s result for its peeked socket.§impl<T> DatagramSocketExt for Twhere
T: DatagramSocket + ?Sized,
impl<T> DatagramSocketExt for Twhere
T: DatagramSocket + ?Sized,
§fn recv<'a>(
&'a mut self,
buffer: &'a mut [u8],
) -> impl Future<Output = Result<DatagramMetadata, DatagramError>> + Send + 'awhere
Self: Sized,
fn recv<'a>(
&'a mut self,
buffer: &'a mut [u8],
) -> impl Future<Output = Result<DatagramMetadata, DatagramError>> + Send + 'awhere
Self: Sized,
buffer.§fn recv_batch<'a, 'buffer>(
&'a mut self,
buffers: &'a mut [IoSliceMut<'buffer>],
metadata: &'a mut [DatagramMetadata],
) -> impl Future<Output = Result<usize, DatagramError>> + Send + 'awhere
'buffer: 'a,
Self: Sized,
fn recv_batch<'a, 'buffer>(
&'a mut self,
buffers: &'a mut [IoSliceMut<'buffer>],
metadata: &'a mut [DatagramMetadata],
) -> impl Future<Output = Result<usize, DatagramError>> + Send + 'awhere
'buffer: 'a,
Self: Sized,
§impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
impl<T> ForwardedClientExt for Twhere
T: ExtensionsRef + ?Sized,
§fn forwarded_client(&self) -> Option<&ForwardedElement>
fn forwarded_client(&self) -> Option<&ForwardedElement>
§fn forwarded_client_ip(&self) -> Option<IpAddr>
fn forwarded_client_ip(&self) -> Option<IpAddr>
for node.§fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
fn forwarded_client_socket_addr(&self) -> Option<SocketAddress>
for node.§fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
fn forwarded_client_host(&self) -> Option<&ForwardedAuthority>
§fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
fn forwarded_client_proto(&self) -> Option<ForwardedProtocol>
§fn forwarded_client_version(&self) -> Option<ForwardedVersion>
fn forwarded_client_version(&self) -> Option<ForwardedVersion>
§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> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more