pub struct WsAdapter;Expand description
v1.4.106 D1 5c: WS surface adapter — AuthDecision::Reject 翻成 silent drop.
历史: WS 在 v1.4.103 / v1.4.104 阶段 3 都按 silent drop 处理 reject (与 v1.4.103 行为一致, 防 timing 探测 — 给客户端任何 wire response 都让 它知道帧被读了 vs 没读). v1.4.106 D1 把这层“翻译为 unit“也走 trait, 让 4 surface SurfaceAdapter 一致.
WireResponse = (): WS 不发任何东西回 client; 调用方拿 Option<()>
知道是 reject (Some) 还是 allow (None) 即可继续 dispatch / 丢弃.
不变量: translate_reject 不能写日志 (pipeline 已 audit::reject 一次,
不要重复). 只 drain reason / kind 让它进 _.
Trait Implementations§
Source§impl SurfaceAdapter for WsAdapter
impl SurfaceAdapter for WsAdapter
Source§type WireResponse = ()
type WireResponse = ()
该 surface 的 wire-format response 类型. Read more
Source§fn surface_id() -> SurfaceId
fn surface_id() -> SurfaceId
surface id, 给 audit / metrics 用.
Source§fn translate_reject(kind: RejectKind, reason: String) -> Self::WireResponse
fn translate_reject(kind: RejectKind, reason: String) -> Self::WireResponse
把 [
RejectKind] + reason 翻成本 surface 的 wire-format error. Read more§fn translate_decision(decision: AuthDecision) -> Option<Self::WireResponse>
fn translate_decision(decision: AuthDecision) -> Option<Self::WireResponse>
便捷适配: 直接传 [
AuthDecision], 若 Allow 则返 None, Reject 则返
Some(wire_response). caller ? short-circuit 用. Read moreAuto Trait Implementations§
impl Freeze for WsAdapter
impl RefUnwindSafe for WsAdapter
impl Send for WsAdapter
impl Sync for WsAdapter
impl Unpin for WsAdapter
impl UnsafeUnpin for WsAdapter
impl UnwindSafe for WsAdapter
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