Skip to content

Coveringnetworks#47

Open
hiddn wants to merge 4 commits intoyl2chen:masterfrom
hiddn:coveringnetworks
Open

Coveringnetworks#47
hiddn wants to merge 4 commits intoyl2chen:masterfrom
hiddn:coveringnetworks

Conversation

@hiddn
Copy link
Copy Markdown

@hiddn hiddn commented Dec 31, 2022

Addition of the CoveringNetworks() and CoveringOrCoveredNetworks() methods. I'm certainly open to better name choices if you have something better in mind.

This lib is useful to me and I use these additions, especially CoveringOrCoveredNetworks(). I'm happy if they can benefit others too.

-Hidden

@hiddn
Copy link
Copy Markdown
Author

hiddn commented Jan 6, 2023

@yl2chen, after I opened PR #47, I noticed there was another PR with the exact same name (PR #43), which is still open (oups).

Re your comment in PR #47, I did test your code suggestion, but with my own PR, with the following line:
func (p *prefixTrie) CoveringNetworks(network net.IPNet) ([]RangerEntry, error) { return p.ContainingNetworks(network.IP.Mask(network.Mask)) }

My tests failed. In test case TestPrefixTrieCoveringNetworks/path_not_taken, CoveringNetworks("192.168.0.0/16") returns "192.168.0.0/24" but shouldn't.

I'm open to adjustments and to discussion.

-Hidden

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.

1 participant