server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: AGPL-3.0-only Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLicenseJWKSURI     = "" // Set on build.
	DefaultLicenseCertsBase64 = "" // Set on build.
)
View Source
var DefaultHTTPUserAgent = "kustomerd/" + version.Version
View Source
var UcredContextKey = &contextKey{"http-server"}

UcredContextKey is a context key. It can be used in HTTP handlers with Context.Value to access the Ucred struct of the request connection. The associated value will be of type *syscall.Ucred

Functions

func GetUcredContextValue

func GetUcredContextValue(ctx context.Context) (*unix.Ucred, bool)

GetUcredContextValue returns the ucred value from the provided context if there is any.

Types

type Collector

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

func NewCollector

func NewCollector(c *Config, claims []*license.Claims) (*Collector, error)

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- ksurveyclient.Metric)

type Config

type Config struct {
	Sub string

	LicensesPath string
	ListenPath   string

	Insecure bool

	Trusted  bool
	JWKSURIs []*url.URL
	CertPool *x509.CertPool

	Logger logrus.FieldLogger

	OnFirstClaims func(*Server)
}

Config bundles configuration settings.

type Server

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

Server is our HTTP server implementation.

func NewServer

func NewServer(c *Config) (*Server, error)

NewServer constructs a server from the provided parameters.

func (*Server) AddRoutes

func (s *Server) AddRoutes(ctx context.Context, router *mux.Router)

AddRoutes add the associated Servers URL routes to the provided router with the provided context.Context.

func (*Server) ClaimsGenHandler

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

ClaimsGenHandler is a http handler which can be used to generate license claims using simple URL form requests.

func (*Server) ClaimsHandler

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

ClaimsHandler is the http hadnler to return the active claims.

func (*Server) ClaimsKopanoProductsHandler

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

ClaimsKopanoProductsHandler is a http handler to return the Kopano product data from all currently active license claims as array.

func (*Server) HealthCheckHandler

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

HealthCheckHandler a http handler return 200 OK when server health is fine.

func (*Server) MakeClaimsWatchHandler

func (s *Server) MakeClaimsWatchHandler() http.HandlerFunc

MakeClaimsWatchHandler return a http handler which returns claims related events as server sent events.

func (*Server) ReloadHandler

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

ReloadHandler is a http handler which triggers reloading of license files and returns when complete.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve starts all the accociated servers resources and listeners and blocks forever until signals or error occurs.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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