ip2location

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	Index    RecordIndex `json:"$index"`
	ID       string      `json:"id"`
	Country  string      `json:"country"`
	State    string      `json:"state"`
	City     string      `json:"city"`
	Zip      string      `json:"zip"`
	Timezone string      `json:"timezone"`
}

A Record is a ip2location record.

type RecordIndex

type RecordIndex struct {
	CIDR string `json:"cidr"`
}

A RecordIndex is how the record is indexed.

type Server

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

Server serves ip2location records

func NewServer

func NewServer(options ...ServerOption) *Server

NewServer creates a new Server.

func (*Server) ServeHTTP

func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

type ServerOption

type ServerOption func(*serverConfig)

A ServerOption customizes the server config.

func WithFile

func WithFile(file string) ServerOption

WithFile sets the file for the config.

Jump to

Keyboard shortcuts

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