Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ members = [
]

[workspace.package]
version = "0.23.0"
version = "0.23.1"
edition = "2021"
authors = ["shellrow <shellrow@foctal.com>"]

[workspace.dependencies]
nex-core = { version = "0.23.0", path = "nex-core" }
nex-datalink = { version = "0.23.0", path = "nex-datalink" }
nex-packet = { version = "0.23.0", path = "nex-packet" }
nex-sys = { version = "0.23.0", path = "nex-sys" }
nex-socket = { version = "0.23.0", path = "nex-socket" }
nex-core = { version = "0.23.1", path = "nex-core" }
nex-datalink = { version = "0.23.1", path = "nex-datalink" }
nex-packet = { version = "0.23.1", path = "nex-packet" }
nex-sys = { version = "0.23.1", path = "nex-sys" }
nex-socket = { version = "0.23.1", path = "nex-socket" }
serde = { version = "1" }
libc = "0.2"
netdev = { version = "0.37" }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ If you want to focus on network interfaces, you can use the [netdev](https://git
`nex-datalink` uses a raw socket which may require elevated privileges depending on your system's configuration.
Execute with administrator privileges if necessary.

## for Windows Users
## For Windows Users
Please note that in order to send and receive raw packets using `nex-datalink` on Windows, [Npcap](https://npcap.com/#download) is required.

1. Install Npcap, making sure to check Install Npcap in WinPcap API-compatible Mode during the installation.

2. Download the Npcap SDK. Add the SDK's /Lib/x64 (or /Lib) folder to your LIB environment variable.

## for macOS Users
On macOS, managing access to the Berkeley Packet Filter (BPF) devices is necessary for send and receive raw packets using `nex-datalink`.
## For macOS Users
On macOS, managing access to the Berkeley Packet Filter (BPF) devices is necessary to send and receive raw packets using `nex-datalink`.
You can use [chmod-bpf](https://github.com/shellrow/chmod-bpf) to automatically manage permissions for BPF devices.
Alternatively, of course, you can also use `sudo` to temporarily grant the necessary permissions.
2 changes: 2 additions & 0 deletions nex-core/src/ip.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! IP address utilities.

use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};

/// Returns [`true`] if the address appears to be globally routable.
Expand Down
2 changes: 2 additions & 0 deletions nex-datalink/src/async_io/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Asynchronous data link layer I/O operations.

#[cfg(any(target_os = "linux", target_os = "android"))]
pub mod linux;

Expand Down
4 changes: 3 additions & 1 deletion nex-packet/src/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,9 @@ impl Packet for TcpPacket {
// Add option padding (zero-filled) to reach the padded length
let written_opt = bytes.len() - before_opts;
let pad = padded_opt_len.saturating_sub(written_opt);
for _ in 0..pad { bytes.put_u8(0); }
for _ in 0..pad {
bytes.put_u8(0);
}

// Append payload
bytes.extend_from_slice(&self.payload);
Expand Down
4 changes: 4 additions & 0 deletions nex-socket/src/icmp/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! ICMP socket.
//!
//! Supplies synchronous and asynchronous interfaces for sending and
//! receiving Internet Control Message Protocol packets.
mod async_impl;
mod config;
mod sync_impl;
Expand Down
4 changes: 4 additions & 0 deletions nex-socket/src/tcp/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! TCP socket.
//!
//! Includes synchronous and asynchronous functionality and configuration
//! helpers for TCP sockets.
mod async_impl;
mod config;
mod sync_impl;
Expand Down
4 changes: 4 additions & 0 deletions nex-socket/src/udp/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! UDP socket.
//!
//! Provides synchronous and asynchronous UDP APIs along with
//! configuration utilities for common socket options.
mod async_impl;
mod config;
mod sync_impl;
Expand Down
2 changes: 2 additions & 0 deletions nex-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ impl Drop for FileDesc {
}
}

/// Sends data to a socket, returning the number of bytes sent.
pub fn send_to(
socket: CSocket,
buffer: &[u8],
Expand All @@ -47,6 +48,7 @@ pub fn send_to(
}
}

/// Receives data from a socket, returning the number of bytes read.
pub fn recv_from(
socket: CSocket,
buffer: &mut [u8],
Expand Down
Loading