-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add floating IP info to the droplet #343
Comments
Hi @roidelapluie, The https://godoc.org/github.com/digitalocean/godo#NetworkV4 In practice, currently a Droplet can only have two public IPv4 addresses, it's assigned address and a floating IP. So you could get at it using something like: func getFloatingIP(droplet *godo.Droplet) (string, error) {
if droplet.Networks == nil {
return "", errors.New("no networks found")
}
publicIP, err := droplet.PublicIPv4()
if err != nil {
return "", err
}
for _, v4 := range droplet.Networks.V4 {
if v4.Type == "public" && v4.IPAddress != publicIP {
return v4.IPAddress, nil
}
}
return "", nil
} It could be nice to expose something like that in godo itself. |
Yes I did find out but is that guaranteed by the API docs that the second will always be the floating IP? |
hello @roidelapluie, I was able to talk to the internal droplets team. We do not guarantee an order of ips. Thank you for your patience. |
The API returns the Floating IP's but there is no way to get them via godo. That would be useful.
The text was updated successfully, but these errors were encountered: