Struct ConnectIpSession
pub struct ConnectIpSession<T = Upgraded> { /* private fields */ }masque only.Expand description
One CONNECT-IP stream, independent of HTTP version and platform packet interfaces.
Implementations§
§impl<T> ConnectIpSession<T>where
T: AsyncRead + AsyncWrite + ExtensionsRef,
impl<T> ConnectIpSession<T>where
T: AsyncRead + AsyncWrite + ExtensionsRef,
pub fn new(
io: T,
role: ConnectIpRole,
config: ConnectIpSessionConfig,
) -> Result<ConnectIpSession<T>, ConnectIpError>
pub fn new( io: T, role: ConnectIpRole, config: ConnectIpSessionConfig, ) -> Result<ConnectIpSession<T>, ConnectIpError>
Wrap an accepted HTTP upgrade. Handshake and admission must happen first.
pub async fn probe_ipv6_mtu(
&mut self,
source: Ipv6Addr,
peer: Ipv6Addr,
nonce: [u8; 16],
) -> Result<Vec<ConnectIpCapsule>, ConnectIpError>
pub async fn probe_ipv6_mtu( &mut self, source: Ipv6Addr, peer: Ipv6Addr, nonce: [u8; 16], ) -> Result<Vec<ConnectIpCapsule>, ConnectIpError>
Validate a previously unverified IPv6 path with a 1280-byte ICMPv6 echo.
Run before splitting the session or forwarding IPv6. nonce must be fresh
for this probe; use unpredictable bytes when stale or injected replies are
a concern. Both addresses must be authorized by the local packet policy.
The peer must answer ICMPv6 echo (an IP stack, or a concurrent call to this
method). No TUN or host routes are needed.
Non-probe packets are discarded during validation. Up to 16 control updates are applied and returned so the caller can handle address requests; their combined entries are bounded by the configured state limit. A write/idle failure, missing reply, overflow or cancellation aborts the tunnel. Success enables an IPv6 link MTU of 1280; larger MTUs still need separate validation.
pub fn split(self) -> (ConnectIpSender<T>, ConnectIpReceiver<T>)
pub fn split(self) -> (ConnectIpSender<T>, ConnectIpReceiver<T>)
Separate packet/control sending from reception. Dropping an unfinished half aborts the tunnel; a successfully closed send half or receive half that reached EOF can be dropped independently.
pub async fn recv(&mut self) -> Result<Option<ConnectIpEvent>, ConnectIpError>
pub async fn recv(&mut self) -> Result<Option<ConnectIpEvent>, ConnectIpError>
Receive an authorized packet or control-state event.
pub async fn send_packet(
&mut self,
packet: Bytes,
origin: IpPacketOrigin,
) -> Result<IpPacketSend, ConnectIpError>
pub async fn send_packet( &mut self, packet: Bytes, origin: IpPacketOrigin, ) -> Result<IpPacketSend, ConnectIpError>
Send a packet, applying local authorization and optional forwarding hop decrement.
pub async fn send_control(
&mut self,
capsule: ConnectIpCapsule,
) -> Result<(), ConnectIpError>
pub async fn send_control( &mut self, capsule: ConnectIpCapsule, ) -> Result<(), ConnectIpError>
Send a validated control snapshot/request.
pub fn next_request_id(&self) -> Result<AddressRequestId, ConnectIpError>
pub fn next_request_id(&self) -> Result<AddressRequestId, ConnectIpError>
Reserve an unused local address request ID.
pub fn state(&self) -> Arc<ConnectIpStateSnapshot> ⓘ
pub fn state(&self) -> Arc<ConnectIpStateSnapshot> ⓘ
Current state snapshot.
pub fn policy(&self) -> &ConnectIpPolicy
pub fn policy(&self) -> &ConnectIpPolicy
Locally authorized policy, including the pinned resolved scope.
pub fn max_packet_size(&self) -> usize
pub fn max_packet_size(&self) -> usize
Current carrier limit for an IP packet, excluding Context ID overhead. IPv6 also remains subject to the configured verified link MTU.
pub fn stats(&self) -> ConnectIpStats
pub fn stats(&self) -> ConnectIpStats
Counters for this tunnel.
pub async fn close(&mut self) -> Result<(), ConnectIpError>
pub async fn close(&mut self) -> Result<(), ConnectIpError>
Finish the request stream within the configured write deadline.
Trait Implementations§
Auto Trait Implementations§
impl<T = Upgraded> !Freeze for ConnectIpSession<T>
impl<T = Upgraded> !RefUnwindSafe for ConnectIpSession<T>
impl<T = Upgraded> !UnwindSafe for ConnectIpSession<T>
impl<T> Send for ConnectIpSession<T>
impl<T> Sync for ConnectIpSession<T>
impl<T> Unpin for ConnectIpSession<T>
impl<T> UnsafeUnpin for ConnectIpSession<T>
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<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