Skip to content

Commit

Permalink
re-format code
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Dec 10, 2024
1 parent 4d0c21d commit 885bde9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
45 changes: 23 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,25 @@ license = "WTFPL"
description = "TUN device creation and handling."
repository = "https://github.com/meh/rust-tun"
keywords = ["tun", "network", "tunnel", "bindings"]
rust-version = "1.77"

[package.metadata.docs.rs]
all-features = true

[lib]
crate-type = ["staticlib", "cdylib", "lib"]

[features]
default = []
# default = ["async"]
async = [
"tokio",
"futures-core",
"futures",
"tokio-util",
"wintun-bindings/async",
]

[dependencies]
bytes = { version = "1" }
cfg-if = "1"
Expand All @@ -25,6 +40,14 @@ tokio = { version = "1", features = [
], optional = true }
tokio-util = { version = "0.7", features = ["codec"], optional = true }

[dev-dependencies]
ctrlc2 = { version = "3", features = ["tokio", "termination"] }
env_logger = "0.11"
futures = "0.3"
packet = "0.1"
serde_json = "1"
tokio = { version = "1", features = ["rt-multi-thread"] }

[target.'cfg(unix)'.dependencies]
nix = { version = "0.29", features = ["ioctl"] }

Expand All @@ -48,28 +71,6 @@ wintun-bindings = { version = "^0.7.7", features = [
[target.'cfg(any(target_os = "macos", target_os = "freebsd"))'.dependencies]
ipnet = "2"

[dev-dependencies]
ctrlc2 = { version = "3", features = ["tokio", "termination"] }
env_logger = "0.11"
futures = "0.3"
packet = "0.1"
serde_json = "1"
tokio = { version = "1", features = ["rt-multi-thread"] }

[features]
default = []
# default = ["async"]
async = [
"tokio",
"futures-core",
"futures",
"tokio-util",
"wintun-bindings/async",
]

[package.metadata.docs.rs]
features = ["async"]

[[example]]
name = "read-async"
required-features = ["async"]
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Device {
| if queues_num > 1 { iff_multi_queue } else { 0 };

let tun_fd = {
let fd = libc::open(b"/dev/net/tun\0".as_ptr() as *const _, O_RDWR);
let fd = libc::open(c"/dev/net/tun".as_ptr() as *const _, O_RDWR);
let tun_fd = Fd::new(fd, true).map_err(|_| std::io::Error::last_os_error())?;

if let Err(err) = tunsetiff(tun_fd.inner, &mut req as *mut _ as *mut _) {
Expand Down

0 comments on commit 885bde9

Please sign in to comment.