geo

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CountryFile = "server-country.mmdb"
	AsnFile     = "origin-asn.mmdb"
)

Files of sapics/ip-location-db (PDDL, no attribution required).

Variables

This section is empty.

Functions

This section is empty.

Types

type HostsSource

type HostsSource interface {
	FibreHosts(ctx context.Context) ([]string, error)
}

type ILocator

type ILocator interface {
	io.Closer

	Start(ctx context.Context)
	Locate(host string) *Location
}

type Location

type Location struct {
	IP          string
	CountryCode string
	ASN         uint32
	ASOrg       string
}

type Locator

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

Locator resolves fibre hosts in the background; Locate never touches DNS.

func NewLocator

func NewLocator(dir string, hosts HostsSource) (*Locator, error)

func (*Locator) Close

func (l *Locator) Close() error

func (*Locator) Locate

func (l *Locator) Locate(host string) *Location

Locate never blocks on DNS: an unknown name returns nil and is queued for resolving.

func (*Locator) Start

func (l *Locator) Start(ctx context.Context)

type Noop

type Noop struct{}

Noop is used when the databases are not available.

func (Noop) Close

func (Noop) Close() error

func (Noop) Locate

func (Noop) Locate(string) *Location

func (Noop) Start

func (Noop) Start(context.Context)

Jump to

Keyboard shortcuts

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