region

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegion

func NewRegion(dbPath, geoType, area string) error

NewRegion initializes the geo region using the specified database path, geo type, and default area

func TypeGeoLite

func TypeGeoLite() string

TypeGeoLite returns the name of the GeoLite type

Types

type GeoInfo

type GeoInfo struct {
	Latitude  float64
	Longitude float64
	IP        string
	Geo       string
}

GeoInfo represents the geo information

func DefaultGeoInfo

func DefaultGeoInfo(ip string) *GeoInfo

DefaultGeoInfo creates a default GeoInfo object with the specified IP and default area

type Region

type Region interface {
	GetGeoInfo(ip string) (*GeoInfo, error)
}

Region represents a geo region interface

func GetRegion

func GetRegion() Region

GetRegion returns the current geo region

func InitGeoLite

func InitGeoLite(dbPath string) (Region, error)

InitGeoLite initializes a new GeoLiteRegion using the given database path

Jump to

Keyboard shortcuts

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