| 1 | package fastly |
| 2 | |
| 3 | // IPAddrs is a sortable list of IP addresses returned by the Fastly API. |
| 4 | type IPAddrs []string |
| 5 | |
| 6 | // IPs returns the list of public IP addresses for Fastly's network. |
| 7 | func (c *Client) IPs() (IPAddrs, error) { |
| 8 | resp, err := c.Get("/public-ip-list", nil) |
| 9 | if err != nil { |
| 10 | return nil, err |
| 11 | } |
| 12 | |
| 13 | var m map[string][]string |
| 14 | if err := decodeJSON(&m, resp.Body); err != nil { |
| 15 | return nil, err |
| 16 | } |
| 17 | return IPAddrs(m["addresses"]), nil |
| 18 | } |