ferranet 0.2.0

A modern, async-first, zero-copy datalink-layer (L2) networking library
Documentation
//! `ferranet` — a modern, async-first, zero-copy datalink-layer (Layer 2) networking library.
//!
//! `ferranet` lets you open a network interface and send/receive raw Ethernet frames with
//! batching and zero-copy receive. It is a spiritual successor to `pnet`'s datalink module,
//! rebuilt around the lessons its original author shared in a
//! [retrospective](https://github.com/rustasync/team/issues/15#issuecomment-408595008):
//! first-class async, justified `unsafe`, an exposed file descriptor, batching, and a
//! "valid until the end of the block" zero-copy receive model.
//!
//! # Platform support
//!
//! v0.1 targets **Linux** behind a `RawChannel` abstraction boundary (in the [`sys`] module), so
//! other platforms (BSD/macOS, Windows) can be added later without changing the public API. The
//! default backend is `AF_PACKET`/`PACKET_MMAP`; an `AF_XDP` backend (`XdpSocket`) is available
//! behind the `xdp` feature.
//!
//! # Permissions
//!
//! Opening an `AF_PACKET` socket requires the `CAP_NET_RAW` capability. For local development
//! you can grant it to a binary with `setcap cap_net_raw+ep <binary>`, or run inside a network
//! namespace / container with `--cap-add=NET_RAW`.

#![forbid(unsafe_op_in_unsafe_fn)]

#[cfg(all(target_os = "linux", feature = "tokio"))]
pub mod async_channel;
#[cfg(target_os = "linux")]
#[doc(hidden)]
pub mod bench_support;
pub mod block;
#[cfg(target_os = "linux")]
pub mod channel;
#[cfg(target_os = "linux")]
pub mod dummy;
pub mod error;
pub mod interface;
pub mod sys;

#[cfg(all(target_os = "linux", feature = "tokio"))]
pub use async_channel::{AsyncReceiver, AsyncSender};
pub use block::{Block, Frame, FrameMeta, Frames, PacketType, VlanTag};
#[cfg(target_os = "linux")]
pub use channel::{Channel, ChannelBuilder, FanoutMode, Receiver, RingConfig, Sender};
pub use error::{Error, Result};
pub use interface::{IfAddr, IfIndex, Interface, MacAddr, interfaces};
pub use sys::Stats;
#[cfg(all(target_os = "linux", feature = "xdp"))]
pub use sys::linux::xdp::{XdpConfig, XdpSocket};