transport

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewUnaryHandler

func NewUnaryHandler(e endpoint.Endpoint, dec decodeRequestFunc, enc encodeResponseFunc, errorEncoder errorEncoderFunc) echo.HandlerFunc

NewUnaryHandler creates and returns an echo.HandlerFunc that accepts a single request and returns a single response

Types

type Endpoints

type Endpoints struct {
	PostAuthenticate              endpoint.Endpoint
	GetFeatureConfigs             endpoint.Endpoint
	GetFeatureConfigsByIdentifier endpoint.Endpoint
	GetTargetSegments             endpoint.Endpoint
	GetTargetSegmentsByIdentifier endpoint.Endpoint
	GetEvaluations                endpoint.Endpoint
	GetEvaluationsByFeature       endpoint.Endpoint
	GetStream                     endpoint.Endpoint
	PostMetrics                   endpoint.Endpoint
	Health                        endpoint.Endpoint
}

Endpoints collects all of the endpoints that make up a ProxyService

func NewEndpoints

func NewEndpoints(p proxyservice.ProxyService) *Endpoints

NewEndpoints returns an initialised Endpoints where each endpoint invokes the corresponding method on the passed ProxyService

type HTTPServer

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

HTTPServer is an http server that handles http requests

func NewHTTPServer

func NewHTTPServer(port int, e *Endpoints, l log.Logger, tlsEnabled bool, tlsCert string, tlsKey string, reg prometheusRegister) *HTTPServer

NewHTTPServer registers the passed endpoints against routes and returns an HTTPServer that's ready to use

func (*HTTPServer) Serve

func (h *HTTPServer) Serve() error

Serve listens on the HTTPServers addr and handles requests

func (*HTTPServer) ServeHTTP

func (h *HTTPServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP makes HTTPServer implement the http.Handler interface

func (*HTTPServer) Shutdown

func (h *HTTPServer) Shutdown(ctx context.Context) error

Shutdown gracefully shutsdown the server

func (*HTTPServer) Use

func (h *HTTPServer) Use(mw ...echo.MiddlewareFunc)

Use applies the passed MiddewareFuncs to all endpoints on the HTTPServer

Jump to

Keyboard shortcuts

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