Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yinqiwen committed Dec 31, 2024
1 parent c2fd306 commit 910306c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ socket2 = "0.5"
[target.'cfg(target_os = "linux")'.dependencies]
libc = "0.2"

[target.'cfg(not(target_os = "windows"))'.dependencies]
aws-lc-rs = { version = "1", features = ["bindgen"], optional = true }
# [target.'cfg(not(target_os = "windows"))'.dependencies]
# aws-lc-rs = { version = "1", features = ["bindgen"], optional = true }
[target.'cfg(target_arch = "arm")'.dependencies]
aws-lc-rs = { version = "1", features = ["bindgen"] }


[target.'cfg(not(target_arch = "arm"))'.dependencies]
mimalloc = { version = "*" }
Expand Down
4 changes: 2 additions & 2 deletions src/tunnel/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use crate::tunnel::http_local::{handle_http, handle_https};
use crate::tunnel::socks5_local::handle_socks5;
use crate::tunnel::tls_local::{handle_tls, valid_tls_version};
use crate::tunnel::Message;
use crate::utils::{new_tcp_listener, set_ip_transparent};
use crate::utils::new_tcp_listener;
use anyhow::{anyhow, Result};
use tokio::net::{TcpListener, TcpStream};
use tokio::net::TcpStream;
use tokio::sync::mpsc;

async fn handle_local_tunnel(
Expand Down
1 change: 0 additions & 1 deletion src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub use error::make_io_error;
pub use metrics::MetricsLogRecorder;
// pub use tls::read_tls_certs;
pub use net::get_original_dst;
pub use net::set_ip_transparent;
pub use net::{get_tproxy_original_dst, new_tcp_listener};
pub use tls::read_private_key;
pub use tls::read_tokio_tls_certs;
8 changes: 2 additions & 6 deletions src/utils/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,11 @@ pub async fn new_tcp_listener(
}

#[cfg(target_os = "linux")]
pub fn set_ip_transparent(socket: &socket2::Socket) -> std::io::Result<()> {
// use std::os::fd::FromRawFd;
// use std::os::unix::io::AsRawFd;
// let fd = socket.as_raw_fd();
// let s = unsafe { socket2::Socket::from_raw_fd(fd) };
fn set_ip_transparent(socket: &socket2::Socket) -> std::io::Result<()> {
socket.set_ip_transparent(true)
}
#[cfg(not(target_os = "linux"))]
pub fn set_ip_transparent(socket: &socket2::Socket) -> std::io::Result<()> {
fn set_ip_transparent(socket: &socket2::Socket) -> std::io::Result<()> {
Ok(())
}

Expand Down

0 comments on commit 910306c

Please sign in to comment.