server

package
v0.0.0-...-7eed66f Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotifyImageChange

func NotifyImageChange(i dim.RegistryIndex, w http.ResponseWriter, r *http.Request)

NotifyImageChange handles docker registry events

func Search(i dim.RegistryIndex, w http.ResponseWriter, r *http.Request)

Search handles docker search request

func Version

func Version(ctx context.Context, w http.ResponseWriter, r *http.Request)

Version return server info including info and uptime

Types

type Authorization

type Authorization struct {
	Path   string
	Method string
	Users  []*Credentials
	// contains filtered or unexported fields
}

Authorization defines restrictions to call a given URL

func GetAuthorization

func GetAuthorization(req *http.Request, auths []*Authorization) *Authorization

GetAuthorization finds the first Authorization matching the request

func (*Authorization) Applies

func (auth *Authorization) Applies(req *http.Request) bool

Applies indicates this Authorization matches the given request

func (*Authorization) CompilePath

func (auth *Authorization) CompilePath() error

CompilePath compiles this Authorization Path member as a regexp

type Config

type Config struct {
	Port           string
	Authorizations []*Authorization
}

Config holds server configuration

type Credentials

type Credentials struct {
	Username, Password string
}

Credentials define a user credentials who can be granted authorizations

type DimHandlerFunc

type DimHandlerFunc func(i dim.RegistryIndex, w http.ResponseWriter, r *http.Request)

DimHandlerFunc injects index into a HandlerFunc function

type RegistryProxy

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

RegistryProxy controls access to registry endpoints and forwards request when user is granted

func NewRegistryProxy

func NewRegistryProxy(registryURL *url.URL, username, password string) *RegistryProxy

NewRegistryProxy creates a RegistryProxy instance

func (*RegistryProxy) Forwards

func (rp *RegistryProxy) Forwards(w http.ResponseWriter, r *http.Request)

Forwards sends request to the actual docker registry

type Server

type Server struct {
	*manners.GracefulServer
	// contains filtered or unexported fields
}

Server type handle indexation of a docker registry and serves the search endpoint

func NewServer

func NewServer(cfg *Config, index dim.RegistryIndex, ctx context.Context, proxy dim.RegistryProxy) *Server

NewServer creates a new Server instance to listen on given port and use given index

func (*Server) Run

func (s *Server) Run() error

Run starts the server instance

func (*Server) RunSecure

func (s *Server) RunSecure(certFile, keyFIile string) error

RunSecure starts the server instance in HTTPS

Jump to

Keyboard shortcuts

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