File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -124,23 +124,21 @@ func getHostnameRoot(platform string) string {
124124func getIPv4 (platform string ) (net.IP , net.IP ) {
125125 switch platform {
126126 case platforms .Azure :
127- // The NIC public IP is not available through Azure metadata...
128- // https://docs.microsoft.com/en-us/answers/questions/7932/public-ip-not-available-via-metadata.html
129127 localIP := net .ParseIP (platforms .AzureGetMetadata ("network/interface/0/ipv4/ipAddress/0/privateIpAddress" ))
130128 publicIP := network .PublicIPv4 ()
131129 return localIP , publicIP
132130 case platforms .EC2 :
133131 localIP := net .ParseIP (platforms .EC2GetMetadata ("local-ipv4" ))
134- publicIP := net . ParseIP ( platforms . EC2GetMetadata ( "public-ipv4" ) )
132+ publicIP := network . PublicIPv4 ( )
135133 return localIP , publicIP
136134 case platforms .GCP :
137135 localIP := net .ParseIP (platforms .GCPGetMetadata ("instance/network-interfaces/0/ip" ))
138- publicIP := net . ParseIP ( platforms . GCPGetMetadata ( "instance/network-interfaces/0/access-configs/0/external-ip" ) )
136+ publicIP := network . PublicIPv4 ( )
139137 return localIP , publicIP
140138 case platforms .SCW :
141139 meta := platforms .SCWGetMetadata ()
142140 localIP := net .ParseIP (meta .PrivateIP )
143- publicIP := net . ParseIP ( meta . PublicIP . Address )
141+ publicIP := network . PublicIPv4 ( )
144142 return localIP , publicIP
145143 default :
146144 localIP := network .LocalIPv4 ()
You can’t perform that action at this time.
0 commit comments