geoserve

package
v0.0.0-...-940aba1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CacheSize = 50000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoServer

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

GeoServer is a server for IP geolocation information

func NewServer

func NewServer(dbFile, dbURL string) (server *GeoServer, err error)

NewServer constructs a new GeoServer using the (optional) uncompressed dbFile. If dbFile is "", then this will fetch the latest GeoLite2-City database from the specified DBURL

func (*GeoServer) Handle

func (server *GeoServer) Handle(resp http.ResponseWriter, req *http.Request, basePath string, allowOrigin string)

Handle is used to handle requests from an HTTP server. basePath is the path at which the containing request handler is registered, and is used to extract the ip address from the remainder of the path. allowOrigin is the cors response config, if not empty it is written to the response header.

Jump to

Keyboard shortcuts

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