pub struct LegacyHook(pub Arc<dyn LegacyProxyHook>);Expand description
Adapts a LegacyProxyHook to ProxyHook, preserving 0.3.x
semantics exactly.
Three behaviours are preserved deliberately:
Self::interestyieldsDATAGRAMS, plusCONTROLonly when the wrapped hook’swants_control_mutation()istrue.DATAGRAMSis unconditional because the 0.3.x datagram hook was the datagram hook, and dropping the flag would stop datagram rewriting for anyone who had it.- A control
Some(bytes)returned by a hook whosewants_control_mutation()isfalseis discarded, as it was in 0.3.x. Mapping it toAction::Replaceunconditionally would make an observe-only hook that returnsSome(..)out of sloppiness start rewriting production traffic — source-compatible, compiling, and semantically inverted. on_datagramreturnsAction::Passwhen the header did not decode, because 0.3.x never called the hook in that case.
One behaviour changes, and it is a change rather than a fix: in
0.3.x on_datagram was unreachable unless an observer was attached. It
now fires regardless.
Tuple Fields§
§0: Arc<dyn LegacyProxyHook>Trait Implementations§
Source§impl ProxyHook for LegacyHook
impl ProxyHook for LegacyHook
Source§fn on_control_message(
&self,
cx: &FrameCtx<'_>,
msg: &AnyControlMessage,
raw: &[u8],
) -> Action
fn on_control_message( &self, cx: &FrameCtx<'_>, msg: &AnyControlMessage, raw: &[u8], ) -> Action
Called before forwarding a control message. Read more
Source§fn on_datagram(
&self,
cx: &FrameCtx<'_>,
header: Option<&AnyDatagramHeader>,
raw: &[u8],
) -> Action
fn on_datagram( &self, cx: &FrameCtx<'_>, header: Option<&AnyDatagramHeader>, raw: &[u8], ) -> Action
Called before forwarding a datagram. Read more
Source§fn on_stream_open(&self, _cx: &StreamCtx<'_>) -> StreamAction
fn on_stream_open(&self, _cx: &StreamCtx<'_>) -> StreamAction
Source§fn on_stream_header(
&self,
_cx: &StreamCtx<'_>,
_header: &DataStreamHeaderKind,
) -> StreamAction
fn on_stream_header( &self, _cx: &StreamCtx<'_>, _header: &DataStreamHeaderKind, ) -> StreamAction
Called once the data stream’s header has been framed and before its
bytes are forwarded. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for LegacyHook
impl !UnwindSafe for LegacyHook
impl Freeze for LegacyHook
impl Send for LegacyHook
impl Sync for LegacyHook
impl Unpin for LegacyHook
impl UnsafeUnpin for LegacyHook
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
Mutably borrows from an owned value. Read more