Skip to main content

AccessControl

Trait AccessControl 

Source
pub trait AccessControl: Send + Sync {
    // Required method
    fn allow(&self, subject: &Subject<'_>, action: Action) -> bool;
}
Expand description

Policy that decides which peers this node talks to, and for what.

Synchronous by design: it runs on the accept loop, so a blocking policy would stall every other inbound connection. Keep its state in memory.

Required Methods§

Source

fn allow(&self, subject: &Subject<'_>, action: Action) -> bool

Returns false to drop the connection.

A Subject::Endpoint is evaluated before the handshake, when only the address is known. A Subject::Peer is evaluated after the handshake, when the identity is available.

Implementors§