2016-03-23 20:53:09 +01:00
|
|
|
package fastly
|
|
|
|
|
|
|
|
// IPAddrs is a sortable list of IP addresses returned by the Fastly API.
|
|
|
|
type IPAddrs []string
|
|
|
|
|
|
|
|
// IPs returns the list of public IP addresses for Fastly's network.
|
|
|
|
func (c *Client) IPs() (IPAddrs, error) {
|
2016-04-20 20:43:54 +02:00
|
|
|
resp, err := c.Get("/public-ip-list", nil)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2016-03-23 20:53:09 +01:00
|
|
|
|
2016-04-20 20:43:54 +02:00
|
|
|
var m map[string][]string
|
|
|
|
if err := decodeJSON(&m, resp.Body); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return IPAddrs(m["addresses"]), nil
|
2016-03-23 20:53:09 +01:00
|
|
|
}
|