Documentation
¶
Index ¶
- func WithAPIKeyValidation(validator APIKeyValidator, next http.HandlerFunc) http.HandlerFunc
- type APIKeyValidator
- type ASNFinder
- type DNSTracker
- type Datastore
- type IataFinder
- type MaxmindFinder
- type Server
- func (s *Server) Delete(rw http.ResponseWriter, req *http.Request)
- func (s *Server) List(rw http.ResponseWriter, req *http.Request)
- func (s *Server) Live(rw http.ResponseWriter, req *http.Request)
- func (s *Server) Lookup(rw http.ResponseWriter, req *http.Request)
- func (s *Server) Ready(rw http.ResponseWriter, req *http.Request)
- func (s *Server) Register(rw http.ResponseWriter, req *http.Request)
- func (s *Server) Reload(ctx context.Context)
- type ServiceAccountSecretManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAPIKeyValidation ¶ added in v0.2.12
func WithAPIKeyValidation(validator APIKeyValidator, next http.HandlerFunc) http.HandlerFunc
WithAPIKeyValidation creates middleware that validates API keys and adds org info to context.
Types ¶
type APIKeyValidator ¶ added in v0.2.12
type APIKeyValidator interface {
// ValidateKey validates the provided API key and returns the associated
// organization name if valid. Returns an error if the key is invalid.
ValidateKey(ctx context.Context, key string) (string, error)
}
APIKeyValidator is an interface for validating API keys and retrieving associated organization info.
type DNSTracker ¶ added in v0.2.0
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
// contains filtered or unexported fields
}
Server maintains shared state for the server.
func NewServer ¶
func NewServer(project string, finder IataFinder, maxmind MaxmindFinder, asn ASNFinder, ds dnsiface.Service, tracker DNSTracker, sm ServiceAccountSecretManager, dsm Datastore, minVersion string) *Server
NewServer creates a new Server instance for request handling.
func (*Server) Delete ¶
func (s *Server) Delete(rw http.ResponseWriter, req *http.Request)
Delete handler is used by operators to delete a previously registered hostname from DNS.
func (*Server) List ¶ added in v0.2.0
func (s *Server) List(rw http.ResponseWriter, req *http.Request)
List handler is used by monitoring to generate a list of known, active hostnames previously registered with the Autojoin API.
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.