geo

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location added in v0.2.0

type Location struct {
	CC          string     `json:"cc"`
	Country     string     `json:"country"`
	Region      string     `json:"region"`
	City        string     `json:"city"`
	Coordinates [2]float32 `json:"coordinates"`
}

type MemcachedProvider added in v0.2.0

type MemcachedProvider struct {
	// contains filtered or unexported fields
}

func NewMemcachedProvider added in v0.2.0

func NewMemcachedProvider(geoDataUrl string, cacheDuration time.Duration) *MemcachedProvider

func (*MemcachedProvider) ByAddress added in v0.2.0

func (p *MemcachedProvider) ByAddress(address string) Location

func (*MemcachedProvider) ByHostname added in v0.2.0

func (p *MemcachedProvider) ByHostname(hostname string) Location

func (*MemcachedProvider) ByIp added in v0.2.0

func (p *MemcachedProvider) ByIp(ip string) Location

type Provider added in v0.2.0

type Provider interface {
	ByAddress(address string) Location
	ByHostname(hostname string) Location
	ByIp(ip string) Location
}

func NewDefaultProvider added in v0.2.0

func NewDefaultProvider() Provider

type Store added in v0.2.0

type Store map[string]Location

func NewStoreFromUrl added in v0.2.0

func NewStoreFromUrl(geoDataUrl string) Store

func (Store) ByAddress added in v0.2.0

func (s Store) ByAddress(address string) Location

func (Store) ByHostname added in v0.2.0

func (s Store) ByHostname(hostname string) Location

func (Store) ByIp added in v0.2.0

func (s Store) ByIp(ip string) Location

Jump to

Keyboard shortcuts

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