Documentation
¶
Index ¶
Constants ¶
View Source
const (
URLFmt = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-%s&license_key=%s&suffix=tar.gz"
)
Variables ¶
View Source
var Cfg = new(Config)
Cfg is the global configuration variable through the entire program, it stores the all GeoLite2 database configurations, including Type and LicenseKey. You should call Initialize function first to initialize this variable.
Functions ¶
func Initialize ¶
Initialize parse the command line arguments, read license key from env, parse the json configuration file and then initialize the Cfg variable.
Types ¶
type Config ¶
type Config struct {
Databases []*GeoLite2DatabaseConfig `json:"databases"`
AutoUpdate bool `json:"autoUpdate"`
LicenseKey string `json:"licenseKey"`
URLFmt string `json:"urlFmt"`
CacheDir string `json:"cacheDir"`
}
func (*Config) UnmarshalJSON ¶
type GeoLite2DatabaseConfig ¶
type GeoLite2DatabaseConfig struct {
Type string `json:"type"`
Path string `json:"path"`
AutoUpdate bool `json:"autoUpdate"`
LicenseKey string `json:"licenseKey"`
}
func (*GeoLite2DatabaseConfig) UnmarshalJSON ¶
func (g *GeoLite2DatabaseConfig) UnmarshalJSON(b []byte) error
Click to show internal directories.
Click to hide internal directories.