GCP VMs do not have their public IP addresses configured on local interfaces. uuid-annotator need to be able to identify whether the server or client was the source of a particular TCP flow, and uses the addresses it finds on the local interface to help determine this. There was already a bit of code to append the IPv4 address of a VM to the localIPs variable, and this PR just adds the IPv6 address too.
Additionally, instead of calling net.ParseCIDR() a second time, just use the net.IPNet values already provided by parseCIDR earlier in the same function.
Fixes a unit test to expect an IPv6 address, and converts the appended IPv4 address to a 4-byte representation to match was is actually appended to localIPs.
GCP VMs do not have their public IP addresses configured on local interfaces. uuid-annotator need to be able to identify whether the server or client was the source of a particular TCP flow, and uses the addresses it finds on the local interface to help determine this. There was already a bit of code to append the IPv4 address of a VM to the
localIPs
variable, and this PR just adds the IPv6 address too.Additionally, instead of calling
net.ParseCIDR()
a second time, just use thenet.IPNet
values already provided byparseCIDR
earlier in the same function.Fixes a unit test to expect an IPv6 address, and converts the appended IPv4 address to a 4-byte representation to match was is actually appended to
localIPs
.This change is