database

package
v0.0.0-...-cc9699b Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	sync.RWMutex

	CSVSize int64

	BufferSize int64
	// contains filtered or unexported fields
}

func NewDB

func NewDB() *DB

func (*DB) Init

func (db *DB) Init(token, path string) error

func (*DB) Search

func (db *DB) Search(address string) (*Loc, error)

Search for a given IP address and return a Loc struct.

func (*DB) String

func (db *DB) String() string

String returns a string representation of the DB struct.

type Loc

type Loc struct {
	FirstIP    *big.Int `json:"-"` // First IP address show netblock.
	LastIP     *big.Int `json:"-"` // Last IP address show netblock.
	Properties map[Properties]string
}

func (*Loc) String

func (loc *Loc) String() string

String representation of *IP.

type Properties

type Properties string
const (
	Code      Properties = "Code"      // Two-character country code based on ISO 3166.
	Country   Properties = "Country"   // Country name based on ISO 3166.
	Region    Properties = "Region"    // Region or state name.
	City      Properties = "City"      // City name.
	Latitude  Properties = "Latitude"  // City latitude. Default to capital city latitude if city is unknown.
	Longitude Properties = "Longitude" // City longitude. Default to capital city longitude if city is unknown.
	ZipCode   Properties = "ZipCode"   // ZIP/Postal code.
	TimeZone  Properties = "TimeZone"  // UTC time zone (with DST supported).
)

Jump to

Keyboard shortcuts

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