Expand description
§use-port
use-port provides small helpers for parsing port numbers, classifying port ranges, and mapping a few common services to default ports.
Experimental: this crate is below 0.3.0 and the API may change.
§Example Usage
use use_port::{common_port_name, parse_port, port_range, PortRange};
let port = parse_port("443").unwrap();
assert_eq!(port.value, 443);
assert_eq!(port_range(port.value), PortRange::System);
assert_eq!(common_port_name(port.value), Some("https"));§Scope
- Port parsing from strings.
- Port range classification.
- Small common service-to-port lookup tables.
§Non-goals
- Port scanning.
- Socket binding.
- Service discovery.
§License
Licensed under MIT OR Apache-2.0.
Structs§
- Port
- Stores a validated port number.
Enums§
- Port
Range - Classifies a port into the standard IANA port ranges.
Functions§
- common_
port_ name - Looks up a common service name for a port.
- default_
port_ for_ service - Looks up a default port for a common service name.
- is_
dynamic_ port - Returns
truewhen the port is in the dynamic range. - is_
registered_ port - Returns
truewhen the port is in the registered range. - is_
system_ port - Returns
truewhen the port is in the system range. - is_
valid_ port - Returns
truewhen the input fits into a validu16port number. - parse_
port - Parses a port number from text.
- port_
range - Returns the IANA port range for the provided port.