-
Notifications
You must be signed in to change notification settings - Fork 4
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
IP iteration overflows #5
Comments
With regard to a): I think it would be useful to signal when reaching the "end", whether it's iterating from above or below. Like python's |
@cbertinato isn't that what we achieve already? iter := ipx.IterIPs(net.ParseIP("0.0.0.0"), 1, nil)
for iter.Next() {
}
// you've reached end, last must've been 255.255.255.255 |
Ah yeah. Derp. I spoke without trying. My bad. |
Haha no worries. I think there is some slight ambiguity as the loop could also immediately return false because of illegal arguments (e.g. step that will never reach end), but I basically think it's acceptable. |
In general, because the only errors you can encounter with this are blatant programmer mistakes (e.g. nil pointers, steps that never hit their target), I've avoided returning errors. Exposing the errors would mean that programmers would have to worry about checking errors in the common case when all that's happening under the covers is math and there's no risk of failure. |
We need tests verifying that the v4/v6 logic behaves appropriately when hitting mins or maxes for their types. That probably looks like a) deciding what is appropriate, b) writing tests and c) making those tests pass.
The text was updated successfully, but these errors were encountered: