http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package http handles http requests for the autoupate service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Autoupdate

func Autoupdate(mux *http.ServeMux, auth Authenticater, connecter Connecter, metric RequestMetricer)

Autoupdate builds the requested keys from the body of a request. The body has to be in the format specified in the keysbuilder package.

func Health

func Health(mux *http.ServeMux)

Health tells, if the service is running.

func MetricRequest

func MetricRequest(mux *http.ServeMux, metric RequestMetricer)

MetricRequest returns the request metrics.

Types

type Authenticater

type Authenticater interface {
	Authenticate(http.ResponseWriter, *http.Request) (context.Context, error)
	FromContext(context.Context) int
}

Authenticater gives an user id for an request. Returns 0 for anonymous.

type ClientError

type ClientError interface {
	Type() string
	Error() string
}

ClientError is an expected error that are returned to the client.

type Connecter

type Connecter interface {
	Connect(userID int, kb autoupdate.KeysBuilder) autoupdate.DataProvider
}

Connecter returns an connect object.

type RequestMetricer

type RequestMetricer interface {
	RequestMeticSave(r []byte) error
	RequestMetricGet(w io.Writer) error
}

RequestMetricer saves metrics about requests.

Jump to

Keyboard shortcuts

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