All my IPv4 addresses come from [4]bytes that I previously converted into
net.IP.
So all my IP are classic IPv4 and not IPv4-mapped into IPv6 address (as
describe into https://tools.ietf.org/html/rfc3493#section-3.7)
https://play.golang.org/p/gqZRUjNw5E
Thx again for this complement.
2016-04-18 11:07 GMT+02:00 Jakob Borg <jakob@nym.se>:
2016-04-17 19:07 GMT+02:00 Jérôme LAFORGE <jerome.laforge@gmail.com>:
using that as a map key is risky business if you don't know how the
net.IP came to be. You're depending on it's internal representation
and there's more than one way it can express the same IP.
https://play.golang.org/p/1QqujZPX5V
//jb
As net.IP is []byte, does the compiler implement the same optimization when
you do this :
var m map[string]string
val, ok := m[string(net.IPv4zero)]
While not what you're asking, note that doing string(someNetIP) andyou do this :
var m map[string]string
val, ok := m[string(net.IPv4zero)]
using that as a map key is risky business if you don't know how the
net.IP came to be. You're depending on it's internal representation
and there's more than one way it can express the same IP.
https://play.golang.org/p/1QqujZPX5V
//jb
--
"The box said 'Requires Windows 95, NT, or better,' so I installed Linux."
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.