Documentation ¶
Index ¶
Constants ¶
const ( MaxmindDownloadFormat = "https://download.maxmind.com/app/geoip_download?license_key=%s&edition_id=%s&suffix=%s" GZIP = MaxmindDownloadSuffix("tar.gz") MD5 = MaxmindDownloadSuffix("tar.gz.md5") )
Variables ¶
Functions ¶
func MaxmindDownloadURL ¶
func MaxmindDownloadURL(licenseKey, editionId string, suffix MaxmindDownloadSuffix) (string, error)
maxmindDownloadURL returns Maxmind download URL reference: maxmind URL https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads
Types ¶
type DownloadOption ¶
type DownloadOption interface {
// contains filtered or unexported methods
}
type DownloadOptionFunc ¶
type DownloadOptionFunc func(cfg *downloadConfig)
func WithErrorFunc ¶
func WithErrorFunc(f func(error)) DownloadOptionFunc
WithErrorFunc returns a function for setting a method to call if a download failed.
func WithFirstDownloadWait ¶
func WithFirstDownloadWait(d time.Duration) DownloadOptionFunc
WithFirstDownloadWait returns a function for setting first download wait time.
func WithRetries ¶
func WithRetries(retries int) DownloadOptionFunc
WithUpdateInterval returns a function for setting download retry count if a download is failed.
func WithSuccessFunc ¶
func WithSuccessFunc(f func()) DownloadOptionFunc
WithSuccessFunc returns a function for setting a method to call if a download succeeded.
func WithUpdateInterval ¶
func WithUpdateInterval(d time.Duration) DownloadOptionFunc
WithUpdateInterval returns a function for setting download time interval.
type MaxmindDownloadSuffix ¶
type MaxmindDownloadSuffix string
type Reader ¶
type Reader interface { ASN(ipAddress net.IP) (*geoip2_golang.ASN, error) AnonymousIP(ipAddress net.IP) (*geoip2_golang.AnonymousIP, error) City(ipAddress net.IP) (*geoip2_golang.City, error) ConnectionType(ipAddress net.IP) (*geoip2_golang.ConnectionType, error) Country(ipAddress net.IP) (*geoip2_golang.Country, error) Domain(ipAddress net.IP) (*geoip2_golang.Domain, error) Enterprise(ipAddress net.IP) (*geoip2_golang.Enterprise, error) ISP(ipAddress net.IP) (*geoip2_golang.ISP, error) Metadata() maxminddb.Metadata Close() error }
support to interface for oschwald/geoip2-golang.
func OpenURL ¶
func OpenURL(licenseKey, editionId, storeDir string, opts ...DownloadOption) (Reader, error)
OpenURL returns geoip Reader from maxmind download URL and updates automatically the latest maxmind databases. reference: maxmind URL https://dev.maxmind.com/geoip/geoipupdate/#Direct_Downloads