pub trait ClientFilter: Send + Sync {
// Required method
fn accept(&self, hello: &Hello) -> bool;
}Expand description
Connection-level client filter — called after Hello, before authentication.
Use this to implement MAC allowlists, IP-based filtering, or rate limiting.
Return true to accept the client, false to disconnect immediately.
§Example: MAC allowlist
use snapcast_server::auth::ClientFilter;
use snapcast_server::Hello;
struct MacAllowlist(Vec<String>);
impl ClientFilter for MacAllowlist {
fn accept(&self, hello: &Hello) -> bool {
self.0.is_empty() || self.0.iter().any(|m| m.eq_ignore_ascii_case(&hello.mac))
}
}