location

package
v0.1.8-rc0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBFilename        = "IP2LOCATION-LITE-DB9.BIN"
	DBFileLocation    = "/tmp/location_db.bin"
	DBZIPFileLocation = "/tmp/location_db.bin" + ".zip"
	// REF: Original location from ip2location DB is: "https://www.ip2location.com/download/?token=OpOljbgT6K2WJnFrFBBmBzRVNpHlcYqNN4CMeGavvh0pPOpyu16gKQyqvDMxTDF4&file=DB9LITEBIN"
	DbUrl = "https://raw.githubusercontent.com/netobserv/flowlogs-pipeline/main/contrib/location/location.db"
)

Variables

This section is empty.

Functions

func InitLocationDB

func InitLocationDB() error

Types

type Info

type Info struct {
	CountryName     string `json:"country_name"`
	CountryLongName string `json:"country_long"`
	RegionName      string `json:"region_name"`
	CityName        string `json:"city_name"`
	Latitude        string `json:"latitude"`
	Longitude       string `json:"longitude"`
}

func GetLocation

func GetLocation(ip string) (error, *Info)

type OSIO

type OSIO struct {
	Stat     func(string) (os.FileInfo, error)
	Create   func(string) (*os.File, error)
	MkdirAll func(string, os.FileMode) error
	OpenFile func(string, int, os.FileMode) (*os.File, error)
	Copy     func(io.Writer, io.Reader) (int64, error)
}

Jump to

Keyboard shortcuts

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