geoiptest

package
v0.30.2 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package geoiptest writes small GeoIP databases for tests, so no test needs a real one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CityDatabase

func CityDatabase(tb testing.TB, at Place) []byte

CityDatabase returns a City database, in the DB-IP City Lite layout, that places every IPv4 and IPv6 address at at. It fails tb when the database cannot be built.

func WriteCityDatabase

func WriteCityDatabase(tb testing.TB, path string, at Place)

WriteCityDatabase writes CityDatabase for at to path. It fails tb when the file cannot be written.

Types

type Place

type Place struct {
	Country   string
	Latitude  float64
	Longitude float64
}

Place is where a test database puts every address: Country, an ISO 3166-1 code such as "CH", and a position in degrees.

Jump to

Keyboard shortcuts

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