Browse Source

Only include setup feature on Linux

pull/26/head
B. Blechschmidt 3 years ago
parent
commit
cb1babebd4
  1. 7
      src/main.rs
  2. 2
      src/setup.rs

7
src/main.rs

@ -5,10 +5,12 @@ use std::net::IpAddr;
use std::process::ExitCode;
use tun2proxy::error::Error;
use tun2proxy::setup::{get_default_cidrs, Setup};
use tun2proxy::Options;
use tun2proxy::{main_entry, Proxy};
#[cfg(target_os = "linux")]
use tun2proxy::setup::{get_default_cidrs, Setup};
/// Tunnel interface to proxy
#[derive(Parser)]
#[command(author, version, about = "Tunnel interface to proxy.", long_about = None)]
@ -66,6 +68,8 @@ fn main() -> ExitCode {
}
if let Err(e) = (|| -> Result<(), Error> {
#[cfg(target_os = "linux")]
{
let mut setup: Setup;
if args.setup == Some(ArgSetup::Auto) {
let bypass_tun_ip = match args.setup_ip {
@ -83,6 +87,7 @@ fn main() -> ExitCode {
setup.drop_privileges()?;
}
}
main_entry(&args.tun, &args.proxy, options)?;

2
src/setup.rs

@ -1,3 +1,5 @@
#![cfg(target_os = "linux")]
use crate::error::Error;
use smoltcp::wire::IpCidr;
use std::convert::TryFrom;

Loading…
Cancel
Save