geoip

package
v0.0.0-...-266a499 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DownloadScheme                        = "https"
	DownloadHost                          = "download.maxmind.com"
	DownloadPath                          = "/app/geoip_download"
	NameASN                               = "ASN"
	NameCountry                           = "Country"
	NameCity                              = "City"
	GeoLite2CityBlocksIPv4CSVFileName     = "GeoLite2-City-Blocks-IPv4.csv"
	GeoLite2CityBlocksIPv6CSVFileName     = "GeoLite2-City-Blocks-IPv6.csv"
	GeoLite2CityLocationsEnCSVFileName    = "GeoLite2-City-Locations-en.csv"
	GeoLite2ASNBlocksIPv4CSVFileName      = "GeoLite2-ASN-Blocks-IPv4.csv"
	GeoLite2ASNBlocksIPv6CSVFileName      = "GeoLite2-ASN-Blocks-IPv6.csv"
	GeoLite2CountryBlocksIPv4CSVFileName  = "GeoLite2-Country-Blocks-IPv4.csv"
	GeoLite2CountryBlocksIPv6CSVFileName  = "GeoLite2-Country-Blocks-IPv6.csv"
	GeoLite2CountryLocationsEnCSVFileName = "GeoLite2-Country-Locations-en.csv"
)

Variables

This section is empty.

Functions

func CheckFileExists

func CheckFileExists(filePath string) (exists bool, err error)

func ExtractASN

func ExtractASN(zipPath, dest string) error

func ExtractCity

func ExtractCity(zipPath, dest string) error

func ExtractCountry

func ExtractCountry(zipPath, dest string) error

func UnzipFiles

func UnzipFiles(src, dest string) error

Types

type FetchASNFilesOutput

type FetchASNFilesOutput struct {
	Version        string
	CompressedPath string
	DataRoot       string
	IPv4FilePath   string
	IPv6FilePath   string
}

type FetchCityFilesOutput

type FetchCityFilesOutput struct {
	Version           string
	CompressedPath    string
	DataRoot          string
	IPv4FilePath      string
	IPv6FilePath      string
	LocationsFilePath string
}

type FetchCountryFilesOutput

type FetchCountryFilesOutput struct {
	Version           string
	CompressedPath    string
	DataRoot          string
	IPv4FilePath      string
	IPv6FilePath      string
	LocationsFilePath string
}

type FetchFilesInput

type FetchFilesInput struct {
	ASN     bool
	Country bool
	City    bool
}

type FetchFilesOutput

type FetchFilesOutput struct {
	ASNVersion                string
	ASNCompressedFilePath     string
	ASNIPv4FilePath           string
	ASNIPv6FilePath           string
	ASNDataPath               string
	CityVersion               string
	CityIPv4FilePath          string
	CityIPv6FilePath          string
	CityLocationsFilePath     string
	CityCompressedFilePath    string
	CityDataPath              string
	CountryVersion            string
	CountryIPv4FilePath       string
	CountryIPv6FilePath       string
	CountryLocationsFilePath  string
	CountryCompressedFilePath string
	CountryDataPath           string
}

type GeoIP

type GeoIP struct {
	Client     *retryablehttp.Client
	LicenseKey string
	Root       string
	Edition    string
	DBFormat   string // mmdb or csv
	Extract    bool
	Replace    bool
}

func New

func New() GeoIP

func (*GeoIP) FetchASNFiles

func (gc *GeoIP) FetchASNFiles() (output FetchASNFilesOutput, err error)

func (*GeoIP) FetchAllFiles

func (gc *GeoIP) FetchAllFiles() (output FetchFilesOutput, err error)

func (*GeoIP) FetchCityFiles

func (gc *GeoIP) FetchCityFiles() (output FetchCityFilesOutput, err error)

func (*GeoIP) FetchCountryFiles

func (gc *GeoIP) FetchCountryFiles() (output FetchCountryFilesOutput, err error)

func (*GeoIP) FetchFile

func (gc *GeoIP) FetchFile(dbName string) (filePath string, err error)

func (*GeoIP) FetchFileName

func (gc *GeoIP) FetchFileName(dbName string) (filename string, err error)

func (*GeoIP) FetchFiles

func (gc *GeoIP) FetchFiles(input FetchFilesInput) (output FetchFilesOutput, err error)

func (*GeoIP) Validate

func (gc *GeoIP) Validate() error

type LeveledLogrus

type LeveledLogrus struct {
	*logrus.Logger
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL