service

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnauthorized = errors.New("unauthorized")

	ErrNoSuchCommand = errors.New("no such command")

	ErrGortBundleDisabled = errors.New("gort bundle disabled")
)
View Source
var (
	// ErrMissingValue is returned by a method when an expected form field
	// is missing.
	ErrMissingValue = errors.New("a form value is missing")
)

Functions

func GenerateTemporaryTLSKeys added in v0.9.0

func GenerateTemporaryTLSKeys() (string, string, error)

Types

type RESTServer

type RESTServer struct {
	*http.Server
	// contains filtered or unexported fields
}

RESTServer represents a Gort REST API service.

func BuildRESTServer

func BuildRESTServer(ctx context.Context, addr string) *RESTServer

BuildRESTServer builds a RESTServer.

func (*RESTServer) ListenAndServe

func (s *RESTServer) ListenAndServe() error

ListenAndServe starts the Gort web service.

func (*RESTServer) ListenAndServeTLS added in v0.9.0

func (s *RESTServer) ListenAndServeTLS(certFile string, keyFile string) error

ListenAndServe starts the Gort web service.

func (*RESTServer) Requests

func (s *RESTServer) Requests() <-chan RequestEvent

Requests retrieves the channel to which user request events are sent.

type RequestEvent

type RequestEvent struct {
	Addr      string
	UserID    string
	Timestamp time.Time
	Request   string
	Status    int
	Size      int64
}

RequestEvent represents a request of a service endpoint.

func (RequestEvent) String

func (e RequestEvent) String() string

type StatusCaptureWriter

type StatusCaptureWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

StatusCaptureWriter is a wrapper around a http.ResponseWriter that is used by middleware to capture a response status and byte length for logging purposes.

func (StatusCaptureWriter) Header

func (w StatusCaptureWriter) Header() http.Header

Header returns the header map that will be sent by http.WriteHeader.

func (StatusCaptureWriter) Write

func (w StatusCaptureWriter) Write(bytes []byte) (int, error)

Write writes the data to the connection as part of an HTTP reply.

func (StatusCaptureWriter) WriteHeader

func (w StatusCaptureWriter) WriteHeader(statusCode int)

WriteHeader sends an HTTP response header with the provided status code.

Jump to

Keyboard shortcuts

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