Skip to content

Commit b9db89d

Browse files
author
root
committed
fix: remove unused imports/vars for cross-platform ci
- remove XdpBridge import, use fully qualified path - gate XdpBridge usage with #[cfg(target_os = "linux")] - suppress unused TUN vars on non-linux with _ binding
1 parent 65a4bc5 commit b9db89d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

sush_daemon/src/main.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use clap::{Parser, Subcommand};
55
use sha2::{Digest, Sha256};
66
use std::net::SocketAddr;
77
use std::sync::Arc;
8-
use sush_core::{EncodingProfile, PortHopper, UserManager, XdpBridge};
8+
use sush_core::{EncodingProfile, PortHopper, UserManager};
99
use tokio::time::Duration;
1010

1111
#[cfg(target_os = "linux")]
@@ -390,6 +390,7 @@ async fn main() -> Result<()> {
390390
}
391391
#[cfg(not(target_os = "linux"))]
392392
Mode::Tun => {
393+
let _ = (tun_name, tun_addr, tun_dst_addr); // suppress unused warning
393394
anyhow::bail!("TUN mode is only supported on Linux");
394395
}
395396
Mode::Socks5 => {
@@ -1820,8 +1821,9 @@ async fn run_tun_mode_v3(
18201821
if tunnel.peer_addr.port() == 0 {
18211822
tunnel.peer_addr = peer;
18221823
println!("Authenticated peer from {}", peer);
1824+
#[cfg(target_os = "linux")]
18231825
if let std::net::SocketAddr::V4(v4) = peer {
1824-
let xdp = XdpBridge::new();
1826+
let xdp = sush_core::XdpBridge::new();
18251827
let _ = xdp.authorize_ip(*v4.ip());
18261828
}
18271829
let mut state = web_state.state.write().await;
@@ -2039,8 +2041,9 @@ async fn run_tun_mode(
20392041
println!("Authenticated peer connected from {}", peer);
20402042

20412043
// Notify XDP bridge of authenticated client (for kernel bypass)
2044+
#[cfg(target_os = "linux")]
20422045
if let std::net::SocketAddr::V4(v4_addr) = peer {
2043-
let xdp_bridge = XdpBridge::new();
2046+
let xdp_bridge = sush_core::XdpBridge::new();
20442047
if let Err(e) = xdp_bridge.authorize_ip(*v4_addr.ip()) {
20452048
// Non-fatal: XDP may not be running
20462049
eprintln!("XDP bridge: {}", e);

0 commit comments

Comments
 (0)