1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use void::Void;
use tls_api::spi_acceptor_common;
use tls_api::AsyncSocket;
use tls_api::AsyncSocketBox;
use tls_api::ImplInfo;
use crate::Error;
use std::future::Future;
pub struct TlsAcceptorBuilder(Void);
pub struct TlsAcceptor(Void);
impl tls_api::TlsAcceptorBuilder for TlsAcceptorBuilder {
type Acceptor = TlsAcceptor;
type Underlying = Void;
fn set_alpn_protocols(&mut self, _protocols: &[&[u8]]) -> anyhow::Result<()> {
Err(anyhow::Error::new(Error))
}
fn underlying_mut(&mut self) -> &mut Void {
&mut self.0
}
fn build(self) -> anyhow::Result<TlsAcceptor> {
Err(anyhow::Error::new(Error))
}
}
impl TlsAcceptor {
fn accept_impl<'a, S>(
&'a self,
_stream: S,
) -> impl Future<Output = anyhow::Result<crate::TlsStream<S>>> + 'a
where
S: AsyncSocket,
{
async { Err(anyhow::Error::new(Error)) }
}
}
impl tls_api::TlsAcceptor for TlsAcceptor {
type Builder = TlsAcceptorBuilder;
const IMPLEMENTED: bool = false;
const SUPPORTS_ALPN: bool = false;
const SUPPORTS_DER_KEYS: bool = false;
const SUPPORTS_PKCS12_KEYS: bool = false;
type Underlying = Void;
type TlsStream = crate::TlsStream<AsyncSocketBox>;
fn underlying_mut(&mut self) -> &mut Self::Underlying {
&mut self.0
}
fn info() -> ImplInfo {
crate::info()
}
spi_acceptor_common!();
}