mirror of
https://github.com/erebe/wstunnel.git
synced 2025-09-26 19:21:10 +08:00
ech
This commit is contained in:
@@ -93,6 +93,10 @@ async fn create_client_tunnels(
|
||||
TransportScheme::Ws | TransportScheme::Http => None,
|
||||
TransportScheme::Wss | TransportScheme::Https => {
|
||||
let ech_config = if args.tls_ech_enable {
|
||||
#[cfg(not(feature = "aws-lc-rs"))]
|
||||
return Err(anyhow!("Your current build does not support ECH. You need to use aws-lc crypto provider"));
|
||||
|
||||
#[cfg(feature = "aws-lc-rs")]
|
||||
dns_resolver
|
||||
.lookup_ech_config(&args.remote_addr.host().unwrap().to_owned())
|
||||
.await?
|
||||
|
@@ -7,7 +7,7 @@ use hickory_resolver::name_server::GenericConnector;
|
||||
use hickory_resolver::proto::runtime::iocompat::AsyncIoTokioAsStd;
|
||||
use hickory_resolver::proto::runtime::{RuntimeProvider, TokioHandle, TokioRuntimeProvider, TokioTime};
|
||||
use hickory_resolver::proto::xfer::Protocol;
|
||||
use hickory_resolver::{ResolveError, Resolver};
|
||||
use hickory_resolver::{ Resolver};
|
||||
use log::warn;
|
||||
use std::future::Future;
|
||||
use std::net::{IpAddr, SocketAddr, SocketAddrV4, SocketAddrV6};
|
||||
@@ -15,9 +15,13 @@ use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::net::{TcpStream, UdpSocket};
|
||||
use tokio_rustls::rustls::client::EchConfig;
|
||||
use url::{Host, Url};
|
||||
|
||||
#[cfg(feature = "aws-lc-rs")]
|
||||
use hickory_resolver::ResolveError;
|
||||
#[cfg(feature = "aws-lc-rs")]
|
||||
use tokio_rustls::rustls::client::EchConfig;
|
||||
|
||||
// Interleave v4 and v6 addresses as per RFC8305.
|
||||
// The first address is v6 if we have any v6 addresses.
|
||||
#[inline]
|
||||
@@ -65,11 +69,6 @@ impl DnsResolver {
|
||||
Ok(addrs)
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "aws-lc-rs"))]
|
||||
pub async fn lookup_ech_config(&self, _domain: &Host) -> Result<Option<EchConfig>, ResolveError> {
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
#[cfg(feature = "aws-lc-rs")]
|
||||
pub async fn lookup_ech_config(&self, domain: &Host) -> Result<Option<EchConfig>, ResolveError> {
|
||||
use hickory_resolver::proto::rr::rdata::svcb::{SvcParamKey, SvcParamValue};
|
||||
|
Reference in New Issue
Block a user