handlers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(next http.Handler) http.Handler

Logger is an http middleware that logs some information about requests processed using zerolog.

func RealIP added in v0.2.0

func RealIP(i int) func(next http.Handler) http.Handler

RealIP is an http middleware that sets the request remote addr to the result of extracting the IP in the requested index from the X-Forwarded-For header. Positives indexes start by 0 and work like usual slice indexes. Negative indexes are allowed being -1 the last entry in the slice, -2 the next, etc.

Types

type Handlers

type Handlers struct {
	Router http.Handler

	Organizations *org.Handlers
	Users         *user.Handlers
	Packages      *pkg.Handlers
	Repositories  *repo.Handlers
	Subscriptions *subscription.Handlers
	Webhooks      *webhook.Handlers
	APIKeys       *apikey.Handlers
	Static        *static.Handlers
	// contains filtered or unexported fields
}

Handlers groups all the http handlers defined for the hub, including the router in charge of sending requests to the right handler.

func Setup

func Setup(cfg *viper.Viper, svc *Services) *Handlers

Setup creates a new Handlers instance.

func (*Handlers) MetricsCollector

func (h *Handlers) MetricsCollector(next http.Handler) http.Handler

MetricsCollector is an http middleware that collects some metrics about requests processed.

type Metrics

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

Metrics groups some metrics collected from a Handlers instance.

type Services

type Services struct {
	OrganizationManager hub.OrganizationManager
	UserManager         hub.UserManager
	RepositoryManager   hub.RepositoryManager
	PackageManager      hub.PackageManager
	SubscriptionManager hub.SubscriptionManager
	WebhookManager      hub.WebhookManager
	APIKeyManager       hub.APIKeyManager
	ImageStore          img.Store
	Authorizer          hub.Authorizer
}

Services is a wrapper around several internal services used by the handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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