Dont use libc dns resolver by default

+ By default libc dns resolution is blocking.
    Which force async runtime to spawn blocking thread for it
    which lead to heavy memory usage
This commit is contained in:
Σrebe - Romain GERARD 2024-01-02 19:32:47 +01:00
parent 5ae552f713
commit b705484d9f
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
5 changed files with 59 additions and 35 deletions

View file

@ -3,7 +3,6 @@ mod io;
pub mod server;
mod tls_reloader;
use crate::dns::DnsResolver;
use crate::{tcp, tls, LocalProtocol, LocalToRemote, WsClientConfig};
use async_trait::async_trait;
use bb8::ManageConnection;
@ -127,9 +126,9 @@ impl ManageConnection for WsClientConfig {
let timeout = self.timeout_connect;
let tcp_stream = if let Some(http_proxy) = &self.http_proxy {
tcp::connect_with_http_proxy(http_proxy, host, *port, so_mark, timeout).await?
tcp::connect_with_http_proxy(http_proxy, host, *port, so_mark, timeout, &self.dns_resolver).await?
} else {
tcp::connect(host, *port, so_mark, timeout, &DnsResolver::System).await?
tcp::connect(host, *port, so_mark, timeout, &self.dns_resolver).await?
};
match &self.tls {