handler

package
v0.0.0-...-8dfb9f7 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASNFinder

type ASNFinder interface {
	AnnotateIP(src string) *annotator.Network
	Reload(ctx context.Context)
}

ASNFinder is an interface used by the Server to manage ASN information.

type IataFinder

type IataFinder interface {
	Lookup(country string, lat, lon float64) (string, error)
	Find(iata string) (iata.Row, error)
	Load(ctx context.Context) error
}

IataFinder is an interface used by the Server to manage IATA information.

type MaxmindFinder

type MaxmindFinder interface {
	City(ip net.IP) (*geoip2.City, error)
	Reload(ctx context.Context) error
}

MaxmindFinder is an interface used by the Server to manage Maxmind information.

type Server

type Server struct {
	Project string
	Iata    IataFinder
	Maxmind MaxmindFinder
	ASN     ASNFinder
	DNS     dnsiface.Service
}

Server maintains shared state for the server.

func NewServer

func NewServer(project string, finder IataFinder, maxmind MaxmindFinder, asn ASNFinder, ds dnsiface.Service) *Server

NewServer creates a new Server instance for request handling.

func (*Server) Live

func (s *Server) Live(rw http.ResponseWriter, req *http.Request)

Live reports whether the system is live.

func (*Server) Lookup

func (s *Server) Lookup(rw http.ResponseWriter, req *http.Request)

Lookup is a handler used to find the nearest IATA given client IP or lat/lon metadata.

func (*Server) Ready

func (s *Server) Ready(rw http.ResponseWriter, req *http.Request)

Ready reports whether the server is ready.

func (*Server) Register

func (s *Server) Register(rw http.ResponseWriter, req *http.Request)

Register handler is used by autonodes to register their hostname with M-Lab on startup and receive additional needed configuration metadata.

func (*Server) Reload

func (s *Server) Reload(ctx context.Context)

Reload reloads all resources used by the Server.

Jump to

Keyboard shortcuts

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