async_http_client_lite/
client_http_tunnel.rs1pub use async_stream_http_tunnel_grader::Authorization;
2use http::{HeaderMap, HeaderValue};
3
4#[cfg(feature = "http_tunnel")]
6pub(crate) use async_stream_http_tunnel_grader::UnionableHttpTunnelClientGrader;
7
8#[cfg(feature = "http_tunnel__async_http1_lite")]
9use async_stream_http_tunnel_grader::AsyncHttp1LiteClientHttpTunnelGrader;
10
11pub struct ClientHttpTunnel {
15 #[allow(dead_code)]
16 kind: ClientHttpTunnelKind,
17 #[allow(dead_code)]
18 remote_host: String,
19 #[allow(dead_code)]
20 remote_port: u16,
21 #[allow(dead_code)]
22 proxy_authorization: Option<Authorization>,
23 #[allow(dead_code)]
24 proxy_headers: Option<HeaderMap<HeaderValue>>,
25}
26impl ClientHttpTunnel {
27 pub fn new(
28 kind: ClientHttpTunnelKind,
29 remote_host: String,
30 remote_port: u16,
31 proxy_authorization: Option<Authorization>,
32 proxy_headers: Option<HeaderMap<HeaderValue>>,
33 ) -> Self {
34 Self {
35 kind,
36 remote_host,
37 remote_port,
38 proxy_authorization,
39 proxy_headers,
40 }
41 }
42
43 #[cfg(feature = "http_tunnel")]
44 pub(crate) fn into_http_tunnel_grader(self) -> UnionableHttpTunnelClientGrader {
45 match self.kind {
46 #[cfg(feature = "http_tunnel__async_http1_lite")]
47 ClientHttpTunnelKind::AsyncHttp1Lite => {
48 UnionableHttpTunnelClientGrader::AsyncHttp1Lite(
49 AsyncHttp1LiteClientHttpTunnelGrader::new(
50 self.remote_host.to_owned(),
51 self.remote_port,
52 self.proxy_authorization,
53 self.proxy_headers,
54 ),
55 )
56 }
57 }
58 }
59}
60
61pub enum ClientHttpTunnelKind {
65 #[cfg(feature = "http_tunnel__async_http1_lite")]
66 AsyncHttp1Lite,
67}