oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
576 stars 99 forks source link

Consider adding a `Top()` method for Networks #69

Closed baislsl closed 3 years ago

baislsl commented 4 years ago

Could we add a method for the Networks to return the current IPNet, without decoding the result interface.

By now I would like to iterate over all the MMDB database and skip the duplicate address cased by redirection such as 2002::/16. As we know the decoding is a time cost process. Certainly I can pass a nil member structure into the Network method, but I supposed this is not a graceful way. It would be better if the Networks could provide with a method to return the current CIDR directly.

oschwald commented 3 years ago

With the current master, you can skip the duplicate networks using the SkipAliasedNetworks option.

I also plan on adding a way to get the network without unmarshalling, but I am not sure about the exact interface yet. I may just allow you to pass nil to Network.

baislsl commented 3 years ago

With the current master, you can skip the duplicate networks using the SkipAliasedNetworks option.

I also plan on adding a way to get the network without unmarshalling, but I am not sure about the exact interface yet. I may just allow you to pass nil to Network.

Thanks. SkipAliasedNetworks is a useful option in my practice. But I use go mod for dependency and SkipAliasedNetworks was not in the latest git tag. Any plan time for making a new tag for release?

oschwald commented 3 years ago

I tagged a release.