pub trait Limiter: 'static + Send {
    fn on_connection_attempt(&mut self, info: &ConnectionAttempt<'_>) -> Outcome;
}

Required methods

This trait is used to determine the outcome of connection attempts on an endpoint. The implementor returns an Outcome based on the ConnectionAttempt, or other information that the implementor may have.

use s2n_quic::provider::endpoint_limits::{Limiter, ConnectionAttempt, Outcome};

struct MyEndpointLimits {
   handshake_limit: usize,
   delay: core::time::Duration,
}

impl Limiter for MyEndpointLimits {
   fn on_connection_attempt(&mut self, info: &ConnectionAttempt) -> Outcome {
       if info.inflight_handshakes > self.handshake_limit {
           Outcome::retry()
       } else {
           Outcome::allow()
       }
   }
}

Implementors