mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-17 16:01:30 +03:00
fix: Optimize import
This commit is contained in:
@@ -1,14 +1,11 @@
|
|||||||
use std::{
|
use std::{
|
||||||
convert::TryFrom,
|
|
||||||
io::Error as IoError,
|
io::Error as IoError,
|
||||||
net::{SocketAddr, ToSocketAddrs},
|
net::{SocketAddr, ToSocketAddrs},
|
||||||
sync::Arc,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use base64::{engine::general_purpose, Engine};
|
use base64::{engine::general_purpose, Engine};
|
||||||
use httparse::{Error as HttpParseError, Response, EMPTY_HEADER};
|
use httparse::{Error as HttpParseError, Response, EMPTY_HEADER};
|
||||||
use log::info;
|
use log::info;
|
||||||
use rustls_pki_types;
|
|
||||||
use thiserror::Error as ThisError;
|
use thiserror::Error as ThisError;
|
||||||
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, BufStream};
|
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, BufStream};
|
||||||
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
#[cfg(any(target_os = "windows", target_os = "macos"))]
|
||||||
@@ -457,6 +454,7 @@ impl Proxy {
|
|||||||
Input: AsyncRead + AsyncWrite + Unpin,
|
Input: AsyncRead + AsyncWrite + Unpin,
|
||||||
T: IntoTargetAddr<'a>,
|
T: IntoTargetAddr<'a>,
|
||||||
{
|
{
|
||||||
|
use std::convert::TryFrom;
|
||||||
let verifier = rustls_platform_verifier::tls_config();
|
let verifier = rustls_platform_verifier::tls_config();
|
||||||
let url_domain = self.intercept.get_domain()?;
|
let url_domain = self.intercept.get_domain()?;
|
||||||
|
|
||||||
@@ -464,7 +462,7 @@ impl Proxy {
|
|||||||
.map_err(|e| ProxyError::AddressResolutionFailed(e.to_string()))?
|
.map_err(|e| ProxyError::AddressResolutionFailed(e.to_string()))?
|
||||||
.to_owned();
|
.to_owned();
|
||||||
|
|
||||||
let tls_connector = TlsConnector::from(Arc::new(verifier));
|
let tls_connector = TlsConnector::from(std::sync::Arc::new(verifier));
|
||||||
let stream = tls_connector.connect(domain, io).await?;
|
let stream = tls_connector.connect(domain, io).await?;
|
||||||
self.http_connect(stream, target).await
|
self.http_connect(stream, target).await
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user