netsem 0.1.4

Standardized, pure-functional IP address validation and port checking utilities.
Documentation

netsem

Standardized, pure-functional IP address validation and port checking utilities.

netsem (Network Semantics) provides synchronous tools for parsing, classifying, and validating network primitives (IPs, Ports, Sockets). It is designed to be a lightweight foundation for network applications, offering a clear separation between semantic validation (syntax, logic) and OS-level interactions (binding, connecting).

Features

  • Pure Validation: Parse and validate IPs and Ports without touching the OS.
  • IP Classification: Categorize IPs into Loopback, Private, Global, Multicast, or Unspecified.
  • Port Classification: Identify System, User, or Dynamic ports.
  • OS Checks (Optional): Perform actual bind or connect checks using the check feature (powered by socket2).
  • Sync-First: Zero async dependencies. Ready to be wrapped in spawn_blocking if needed.
  • Error Handling: Uses thiserror for structured, inspectable errors.

Usage Examples

Check the examples directory for runnable code:

Installation

[dependencies]
netsem = { version = "0.0.2", features = ["full"] }

Feature Flags

Feature Description
check Enables OS-level checks (check_bind, check_connect) using socket2.
tracing Enables integration with the tracing crate (currently reserved/unused).
serde Enables serde support (currently reserved/unused).
full Enables all features above.

License

Released under the MIT License © 2026 Canmi