Skip to main content

crabka_security/
listener.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4pub enum ListenerProtocol {
5    Plaintext,
6    Ssl,
7    SaslPlaintext,
8    SaslSsl,
9}
10
11impl ListenerProtocol {
12    #[must_use]
13    pub fn requires_tls(self) -> bool {
14        matches!(self, Self::Ssl | Self::SaslSsl)
15    }
16
17    #[must_use]
18    pub fn requires_sasl(self) -> bool {
19        matches!(self, Self::SaslPlaintext | Self::SaslSsl)
20    }
21}