Skip to content

[1/3] [nat] move PortRange to struct - #334

Open
nicolaskagami wants to merge 1 commit into
mainfrom
nsk/nat-1-portrange
Open

[1/3] [nat] move PortRange to struct#334
nicolaskagami wants to merge 1 commit into
mainfrom
nsk/nat-1-portrange

Conversation

@nicolaskagami

@nicolaskagami nicolaskagami commented Aug 6, 2026

Copy link
Copy Markdown

This PR:

  • Moves the PortRange trait into a struct, validating the low <= high invariant by construction.
  • Simplifies overlap function.

This is the first of 3 PRs simplifying and de-duplicating some of the nat.rs code.

Left for future work:

  • Expanding PortRange usage further.
  • Storing ranges in a way that codifies its non-overlapping invariant and stores sorted for faster operations.

@internet-diglett internet-diglett left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Just a few comments.

Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs
Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs Outdated

@taspelund taspelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I'd like to see an approval from @internet-diglett as well before merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants