Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ProviderAmazon is AWS ProviderAmazon = "Amazon Web Services" // ProviderGoogle is Google Cloud ProviderGoogle = "Google Cloud" // ProviderMicrosoft is Microsoft Azure ProviderMicrosoft = "Microsoft Azure" )
Variables ¶
View Source
var ( // ErrNotCloudIP is error returned when IP does not match any of the published list of ranges ErrNotCloudIP = errors.New("not resolved to any known cloud IP range") // ErrCacheRefreshInProgress is returned when RefreshCache is called while an existing refresh is occurring ErrCacheRefreshInProgress = errors.New("cache refresh is already in progress") // ErrDiskCacheExpired is returned when trying to refresh from disk with a file that has exceeded the TTL ErrDiskCacheExpired = errors.New("cache on disk is expired") )
View Source
var (
DefaultCacheRefreshTimeout time.Duration = 2 * time.Minute
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Time to keep IP ranges cached for (default 12 hours) TTL time.Duration CacheFilePath string CacheRefreshTimeout time.Duration // contains filtered or unexported fields }
Client will eventually hold cache of IP ranges
func DefaultClient ¶
func DefaultClient() *Client
DefaultClient is the default Client for resolving requests
func (*Client) RefreshCache ¶
RefreshCache loads the cloud provider subnet data from disk (if available) and then from the web
Click to show internal directories.
Click to hide internal directories.