Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
Client holds data for making calls to the AWS whitelisted endpoint.
type IPRange ¶
type IPRange struct { Type string `json:"ipv"` IPprefix string `json:"ip_prefix"` Region string `json:"region"` Service string `json:"service"` NetworkBorderGroup string `json:"network_border_group"` }
IPRange represents information about whitelisted IP range.
type IPRanges ¶
type IPRanges struct { SyncToken int `json:"sync_token"` CreateDate time.Time `json:"create_date"` IPv4Ranges []IPRange `json:"ipv4_ranges"` IPv6Ranges []IPRange `json:"ipv6_ranges"` }
IPRanges represents IPv4 and IPv6 AWS whitelisted IP ranges.
func GetIPRanges ¶
GetIPRanges pulls AWS Whitelisted IP ranges.
It uses default IP Range client. If you want to use a different AWS Whitelisted IP URL export the env variable "AWS_IP_URL".
func ParseResponse ¶
ParseResponse takes response struct and returns IPRanges.
It errors if the token or timestamp is malformed, or when either IPv4 or IPv6 cannot be parsed.
func (IPRanges) CSVRecords ¶
ToCSVRecords creates csv records ready to pass to a csv writer.
type Response ¶
type Response struct { SyncToken string `json:"syncToken"` CreateDate string `json:"createDate"` Prefixes []struct { IPPrefix string `json:"ip_prefix"` Ipv6Prefix string `json:"ipv6_prefix"` Region string `json:"region"` Service string `json:"service"` NetworkBorderGroup string `json:"network_border_group"` } `json:"prefixes"` }
Response represents data received from AWS after successfull call to the whitelisted ip ranges url: "https://ip-ranges.amazonaws.com/ip-ranges.json"