firewall/
lib.rs

1#[cfg(feature = "rustls")]
2pub mod rustls;
3
4#[cfg(feature = "openssl")]
5pub mod openssl;
6
7#[cfg(feature = "builder")]
8pub mod builder;
9
10#[cfg(feature = "cloudflare")]
11pub mod cloudflare;
12
13#[cfg(feature = "github_webhook")]
14pub mod github;
15
16#[cfg(feature = "cloudflare")]
17mod https;
18
19use std::borrow::Borrow;
20use std::net::IpAddr;
21
22// TODO replace NoClientHello with Never (!) type when stable.
23pub trait Accept<CH: ClientHello = NoClientHello> {
24    fn accept(&self, ip: impl Borrow<IpAddr>, client_hello: Option<CH>) -> bool;
25}
26
27pub trait ClientHello {
28    fn server_name(&self) -> Option<&str>;
29    fn has_alpn(&self, alpn: &[u8]) -> bool;
30}
31
32pub struct NoClientHello {}
33
34impl ClientHello for NoClientHello {
35    fn server_name(&self) -> Option<&str> {
36        unimplemented!()
37    }
38
39    fn has_alpn(&self, _alpn: &[u8]) -> bool {
40        unimplemented!()
41    }
42}