Documentation
¶
Index ¶
- func FindDataFiles(subFolder string) (string, string, error)
- func GetIp4DB() *ip2location.DB
- func GetIp6DB() *ip2location.DB
- func GetLastUpdatedDate() time.Time
- func Ip2Location(ip string) ipInfo
- func Ip4ToLocation(ip string) ipInfo
- func Ip6ToLocation(ip string) ipInfo
- func LookupCountry(ip net.IP) (string, error)
- func OnExit()
- func SetDataFolder(dataFolder string) error
- func SetSubFolder(dataFolder string) error
- type Ip2LocationDataFiles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindDataFiles ¶
function to automatically find the IP2Location data files in the data folder
func GetLastUpdatedDate ¶
GetLastUpdatedDate function to get the last updated date of the sub folder
func Ip4ToLocation ¶
func Ip4ToLocation(ip string) ipInfo
func Ip6ToLocation ¶
func Ip6ToLocation(ip string) ipInfo
func LookupCountry ¶
Function to lookup country by IP address
func OnExit ¶
func OnExit()
OnExit function to close the database connections and save the config file
func SetDataFolder ¶
Function to set IP2Location data folder
func SetSubFolder ¶
Function to set IP2Location data folder
Types ¶
type Ip2LocationDataFiles ¶
type Ip2LocationDataFiles struct {
DataFolder string // data folder path to store IP2Location data files. Example: /path/to/data/
SubFolder string // sub folder path to store IP2Location data files. Example: /path/to/data/september2023/
LastUpdate time.Time // last update time of sub folder.
IPv4 string // IPv4 data file name. Example: IP2LOCATION-LITE-DB11.BIN
IPv6 string // IPv6 data file name. Example: IP2LOCATION-LITE-DB11.IPV6.BIN
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.