Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
SajjadPourali committed Dec 21, 2023
1 parent 77c8e7e commit 4f509ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 2 additions & 7 deletions examples/tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@ async fn main() {
config.packet_information(true);
});

#[cfg(not(target_os = "windows"))]
let mut ipstack_config = ipstack::IpStackConfig::default();

#[cfg(target_os = "windows")]
let ipstack_config = ipstack::IpStackConfig::default();

#[cfg(not(target_os = "windows"))]
ipstack_config.packet_info(true);
ipstack_config.mtu(MTU);
ipstack_config.packet_info(cfg!(target_family = "unix"));

let mut ip_stack =
ipstack::IpStack::new(ipstack_config, tun::create_as_async(&config).unwrap());
Expand Down
8 changes: 3 additions & 5 deletions examples/wintun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ async fn main() {
config.packet_information(true);
});

#[cfg(not(target_os = "windows"))]
let mut ipstack_config = ipstack::IpStackConfig::default();

#[cfg(not(target_os = "windows"))]
ipstack_config.packet_info(true);
ipstack_config.mtu(MTU);
ipstack_config.packet_info(cfg!(target_family = "unix"));

#[cfg(not(target_os = "windows"))]
let mut ip_stack =
ipstack::IpStack::new(ipstack_config, tun::create_as_async(&config).unwrap());

#[cfg(target_os = "windows")]
let mut ip_stack = ipstack::IpStack::new(
ipstack::IpStackConfig::default(),
ipstack_config,
wintun::WinTunDevice::new(ipv4, Ipv4Addr::new(255, 255, 255, 0)),
);

Expand Down

0 comments on commit 4f509ca

Please sign in to comment.