Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coveringnetworks #47

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Coveringnetworks #47

wants to merge 4 commits into from

Conversation

hiddn
Copy link

@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
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