pub trait ChannelHandler: Sized {
type Error: Into<Error> + Error;
const RECORDS_SESSION: bool = false;
// Required methods
fn new(
handle: Handle,
channel_id: ChannelId,
session: Handle,
dev: Arc<Device>,
ctx: &ChannelContext,
) -> impl Future<Output = Result<Self, Self::Error>> + Send;
fn handle_event(
&mut self,
event: &ChannelEvent,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}Expand description
Handler for a channel session.
Provided Associated Constants§
Sourceconst RECORDS_SESSION: bool = false
const RECORDS_SESSION: bool = false
Whether this handler streams its session to the policy’s recorders.
This is a fail-closed gate, not a hint. A policy rule with a non-empty recorders list
obliges the server to record the session; a handler that leaves this false is refused
such a connection outright rather than silently running it un-recorded. Only set it to
true in a handler that actually calls
SessionRecording.
Required Associated Types§
Required Methods§
Sourcefn new(
handle: Handle,
channel_id: ChannelId,
session: Handle,
dev: Arc<Device>,
ctx: &ChannelContext,
) -> impl Future<Output = Result<Self, Self::Error>> + Send
fn new( handle: Handle, channel_id: ChannelId, session: Handle, dev: Arc<Device>, ctx: &ChannelContext, ) -> impl Future<Output = Result<Self, Self::Error>> + Send
Construct a new per-channel handler.
ctx carries the single fail-closed authorization decision made in
auth_none. Handlers MUST NOT re-evaluate policy or
substitute a different user — the accepted identity is the sole authorization source.
This is async because a handler may have to reach the network before the session may
start: a recorded session dials its recorder here, and a session that must be recorded but
cannot be is refused by returning Err — so the shell is never spawned first and recorded
second.
Sourcefn handle_event(
&mut self,
event: &ChannelEvent,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn handle_event( &mut self, event: &ChannelEvent, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Handle an event from the channel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".