Expand description
§dhcplease
A DHCP server library implementing RFC 2131 (DHCP) and RFC 2132 (DHCP Options).
§Features
- Full DHCP protocol: DISCOVER, OFFER, REQUEST, ACK, NAK, RELEASE, DECLINE, INFORM
- BOOTP compatibility for legacy clients
- Static MAC-to-IP bindings
- Lease persistence across restarts
- Relay agent support (Option 82)
- Rate limiting per client
- Async/await with Tokio
§Quick Start
use dhcplease::{Config, DhcpServer};
#[tokio::main]
async fn main() -> dhcplease::Result<()> {
let config = Config::load_or_create("config.json").await?;
let server = DhcpServer::new(config).await?;
server.run().await
}§Architecture
Config- Server configuration (IP pool, lease duration, DNS, etc.)DhcpServer- Main server that listens on UDP port 67Leases- Thread-safe lease manager with persistenceDhcpPacket- DHCP packet parsing and encodingDhcpOption- DHCP option types per RFC 2132
Re-exports§
pub use config::Config;pub use config::StaticBinding;pub use config::normalize_mac;pub use config::sanitize_domain_name;pub use config::sanitize_hostname;pub use error::Error;pub use error::Result;pub use lease::Lease;pub use lease::Leases;pub use options::DhcpOption;pub use options::MessageType;pub use packet::DhcpPacket;pub use server::DHCP_CLIENT_PORT;pub use server::DHCP_SERVER_PORT;pub use server::DhcpServer;