utils

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoIP

type GeoIP struct {
	Db    *ip2location.DB
	Cache *lru.Cache

	AreaMap map[string]string
	// contains filtered or unexported fields
}

func NewGeoIP

func NewGeoIP(dbPath string) (*GeoIP, error)

func (*GeoIP) Close

func (g *GeoIP) Close()

func (*GeoIP) GetLocation

func (g *GeoIP) GetLocation(ipStr string) (*Location, error)

func (*GeoIP) GetLocationV3

func (g *GeoIP) GetLocationV3(ipStr string) (*Location, error)

type Location

type Location struct {
	Country          string  `json:"country"`
	Province         string  `json:"province"`
	City             string  `json:"city"`
	PostalCode       string  `json:"postal_code"`
	Latitude         float32 `json:"latitude"`
	Longitude        float32 `json:"longitude"`
	IsAnonymousProxy bool    `json:"is_anonymous_proxy"`
}

Jump to

Keyboard shortcuts

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