pub struct AuthState {
pub key_store: Arc<KeyStore>,
pub counters: Arc<RuntimeCounters>,
}Expand description
REST auth middleware 的组合 state:KeyStore(谁能进)+ RuntimeCounters(限额)
从 v1.0 起 middleware 除了 scope 检查还会在 trade:real 请求上跑一次
check_and_commit —— CheckCtx 里 market/symbol/side/value 全空,只挂
rate limit + 时段窗口两个全局闸门。精细化检查(daily / per_order /
side / 具体 market)留给下游 handler。
Fields§
§key_store: Arc<KeyStore>keys.json 热可替换 key store(共享同一 [KeyStore] 确保 /reload 生效)
counters: Arc<RuntimeCounters>日累计 / 速率窗口 / rate-limit 的全局计数器;REST / gRPC / MCP 应共用 同一实例才能保证限额跨接口一致
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthState
impl !RefUnwindSafe for AuthState
impl Send for AuthState
impl Sync for AuthState
impl Unpin for AuthState
impl UnsafeUnpin for AuthState
impl !UnwindSafe for AuthState
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