Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ffi/src/tunnel_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ async fn finish_tunnel(
let tunnel_stream = tokio::net::TcpStream::connect(tunnel_addr)
.await
.map_err(|e| IdeviceError::InternalError(format!("TLS tunnel: {e}")))?;
let tunnel =
connect_tls_psk_tunnel_native(Box::new(tunnel_stream), rpc.encryption_key()).await?;
let tunnel = connect_tls_psk_tunnel_native(tunnel_stream, rpc.encryption_key()).await?;

let client_ip: std::net::IpAddr = tunnel
.info
Expand Down
12 changes: 6 additions & 6 deletions idevice/src/remote_pairing/tunnel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const DEFAULT_MTU: u16 = 16000;
///
/// This uses a built-in TLS 1.2 PSK-AES256-CBC-SHA384 implementation with no
/// external TLS library dependency.
pub async fn connect_tls_psk_tunnel_native(
stream: Box<dyn ReadWrite>,
pub async fn connect_tls_psk_tunnel_native<S: ReadWrite>(
stream: S,
encryption_key: &[u8],
) -> Result<CdTunnel<super::tls_psk::TlsPskStream<Box<dyn ReadWrite>>>, IdeviceError> {
) -> Result<CdTunnel<super::tls_psk::TlsPskStream<S>>, IdeviceError> {
let mut tls_stream = super::tls_psk::tls_psk_handshake(stream, encryption_key).await?;
debug!("Native TLS-PSK handshake complete");

Expand Down Expand Up @@ -127,10 +127,10 @@ pub async fn connect_tls_psk_tunnel_native(
/// Requires the `openssl` feature. Consider using [`connect_tls_psk_tunnel_native`]
/// instead, which has no external dependency.
#[cfg(feature = "openssl")]
pub async fn connect_tls_psk_tunnel(
stream: tokio::net::TcpStream,
pub async fn connect_tls_psk_tunnel<S: ReadWrite>(
stream: S,
encryption_key: &[u8],
) -> Result<CdTunnel<tokio_openssl::SslStream<tokio::net::TcpStream>>, IdeviceError> {
) -> Result<CdTunnel<tokio_openssl::SslStream<S>>, IdeviceError> {
use openssl::ssl::{SslConnector, SslMethod, SslVerifyMode};

let psk = encryption_key.to_vec();
Expand Down
5 changes: 2 additions & 3 deletions tools/src/core_device_proxy_tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use clap::{Arg, Command};
use idevice::{
core_device_proxy::{self},
IdeviceService,
core_device_proxy::{self},
};
use tun_rs::AbstractDevice;

Expand Down Expand Up @@ -74,8 +74,7 @@ async fn main() {
32,
)
.unwrap();
dev.set_mtu(tun_proxy.tunnel_info().mtu)
.unwrap();
dev.set_mtu(tun_proxy.tunnel_info().mtu).unwrap();
dev.set_network_address(
tun_proxy.tunnel_info().client_address.clone(),
tun_proxy
Expand Down
Loading