iptocc

package module
v0.0.0-...-2cddeef Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 8 Imported by: 0

README

iptocc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindDataFiles

func FindDataFiles(subFolder string) (string, string, error)

function to automatically find the IP2Location data files in the data folder

func GetIp4DB

func GetIp4DB() *ip2location.DB

GetIp4DB function to get the IPv4 database

func GetIp6DB

func GetIp6DB() *ip2location.DB

GetIp6DB function to get the IPv6 database

func GetLastUpdatedDate

func GetLastUpdatedDate() time.Time

GetLastUpdatedDate function to get the last updated date of the sub folder

func Ip2Location

func Ip2Location(ip string) ipInfo

Ip2Location

func Ip4ToLocation

func Ip4ToLocation(ip string) ipInfo

func Ip6ToLocation

func Ip6ToLocation(ip string) ipInfo

func LookupCountry

func LookupCountry(ip net.IP) (string, error)

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

func SetDataFolder(dataFolder string) error

Function to set IP2Location data folder

func SetSubFolder

func SetSubFolder(dataFolder string) error

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
}

Jump to

Keyboard shortcuts

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