Skip to content

Add Port (net) #51

@vhrcgcom

Description

@vhrcgcom

Description

Implement Port as a ValueObject in the net module.

Spec: u16 in range 1–65535

Implementation checklist

  • Create src/net/port.rs
  • Implement ValueObject trait
  • Add #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
  • Export from src/net/mod.rs and prelude
  • Unit tests: valid input · empty input · invalid format · normalisation
  • Doc comment with # Example block
  • Update status in ROADMAP.md from ⬜ to ✅

Implementation detail

Input / Output

Type Alias
Input u16 PortInput
Output u16 PortOutput

Normalization

None.

Validation

  • Must be in the range 1..=65535. Port 0 is reserved and rejected.

Extra methods

  • is_well_known() -> booltrue for ports 1–1023 (system / well-known ports).
  • is_registered() -> booltrue for ports 1024–49151.
  • is_dynamic() -> booltrue for ports 49152–65535 (ephemeral range).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions