-
Notifications
You must be signed in to change notification settings - Fork 40
proposal: Add an IsPublic() function #151
Comments
In theory, that would be useful. However, I'm wondering if it should be the inverse, i.e. IsBogon that returns true if an IP is in the bogon list. I'm thinking that just because "public" is a bit of a fluid term in IP space, and means different things to different people. I worry about fixing an API with one of those definitions. Perhaps I'm overthinking it and "anything not defined as private or unroutable by RFCs is public" is a definition that makes sense to have. Thoughts @mdlayher @bradfitz? |
To clarify, glancing at your code, it looks like you're implementing IsPublic as "not any of https://ipgeolocation.io/resources/bogon.html". Does that sound right? |
I agree with Dave's assessment. In IPv6 there is already disagreement about whether ULA are "public" or not and I'm sure there are other ranges with similar questions. |
I don't have anything super unique to add here. I'm fine adding a method named |
So, I think our overall feeling is: adding predicates for "what kind of IP is this" we're generally okay with, even for things where the definition evolves a little over time. We're now just arguing about the precise semantics of "what does public mean?". If you send a PR for IsPublic, with a docstring that defines precisely what "public" means (which I think can be something like "unicast IPs not listed in [list of RFCs in your current bogons.go]", I think I'm okay with adding IsPublic. There may be minor disagreements on the meaning of public, but something anchored in RFCs is something I think we can defend as a good definition. |
Great! Let me work on this
…On Thu, 18 Mar 2021 at 15:49, Dave Anderson ***@***.***> wrote:
So, I think our overall feeling is: adding predicates for "what kind of IP
is this" we're generally okay with, even for things where the definition
evolves a little over time. We're now just arguing about the precise
semantics of "what does public mean?".
If you send a PR for IsPublic, with a docstring that defines precisely
what "public" means (which I think can be something like "unicast IPs not
listed in ", I think I'm okay with adding IsPublic. There may be minor
disagreements on the meaning of public, but something anchored in RFCs is
something I think we can defend as a good definition.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#151 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQFHWBJV4NUCXMFFK2INOLTEJKLZANCNFSM4ZJTKT3A>
.
|
Some adhoc research while I attempt this ticket
|
These helped me to cross reference inet.af/netaddr, net.IP, and github.com/mellowdrifter/bogons for inetaf#151. Signed-off-by: Alex Willmer <alex@moreati.org.uk>
These helped me to cross reference inet.af/netaddr, net.IP, and github.com/mellowdrifter/bogons for #151. Signed-off-by: Alex Willmer <alex@moreati.org.uk>
We now have IsGlobalUnicast, IsPrivate, and IsUnspecified. In theory callers could just |
I currently have a bogon checker based on the net.IP package (https://github.com/mellowdrifter/bogons/blob/main/bogons.go#L46)
Is this something I could add into netaddr, or would it be considered a moving target considering new IPs are sometimes added in newer RFCs, though rarely
The text was updated successfully, but these errors were encountered: