endpoints

package
v0.0.0-...-d2438c5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultPort = "8080"

DefaultPort defines the default port for the http server

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoints

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

Endpoints are in charge of bringing up and down the HTTP endpoints for serving the RESTful API.

When it starts up, they start listen to the appropriate sockets and attach the relevant HTTP handlers to them. When it shuts down they close all sockets.

func New

func New(restServer Server, cert *cert.Info, options ...Option) *Endpoints

New creates Endpoints with sane defaults

func (*Endpoints) Down

func (e *Endpoints) Down() error

Down brings down all endpoints and stops serving HTTP requests.

func (*Endpoints) NetworkAddress

func (e *Endpoints) NetworkAddress() string

NetworkAddress returns the network addresses of the network endpoint, or an empty string if there's no network endpoint

func (*Endpoints) NetworkCert

func (e *Endpoints) NetworkCert() *cert.Info

NetworkCert returns the full TLS certificate information for this endpoint.

func (*Endpoints) NetworkPrivateKey

func (e *Endpoints) NetworkPrivateKey() []byte

NetworkPrivateKey returns the private key of the TLS certificate used by the network endpoint.

func (*Endpoints) NetworkPublicKey

func (e *Endpoints) NetworkPublicKey() []byte

NetworkPublicKey returns the public key of the TLS certificate used by the network endpoint.

func (*Endpoints) NetworkUpdateAddress

func (e *Endpoints) NetworkUpdateAddress(address string) error

NetworkUpdateAddress updates the address for the network endpoint, shutting it down and restarting it.

func (*Endpoints) NetworkUpdateCert

func (e *Endpoints) NetworkUpdateCert(cert *cert.Info) error

NetworkUpdateCert updates the TLS keypair and CA used by the network endpoint.

If the network endpoint is active, in-flight requests will continue using the old certificate, and only new requests will use the new one.

func (*Endpoints) PprofAddress

func (e *Endpoints) PprofAddress() string

PprofAddress returns the network addresss of the pprof endpoint, or an empty string if there's no pprof endpoint

func (*Endpoints) PprofUpdateAddress

func (e *Endpoints) PprofUpdateAddress(address string) error

PprofUpdateAddress updates the address for the pprof endpoint, shutting it down and restarting it.

func (*Endpoints) Up

func (e *Endpoints) Up() error

Up brings down all endpoints and stops serving HTTP requests.

type Option

type Option func(*options)

Option to be passed to Connect to customize the resulting instance.

func WithCert

func WithCert(cert *cert.Info) Option

WithCert sets the cert on the option

func WithDebugAddress

func WithDebugAddress(debugAddress string) Option

WithDebugAddress sets the debugAddress on the option

func WithLogger

func WithLogger(logger log.Logger) Option

WithLogger sets the logger on the option

func WithNetworkAddress

func WithNetworkAddress(networkAddress string) Option

WithNetworkAddress sets the networkAddress on the option

func WithRestServer

func WithRestServer(restServer Server) Option

WithRestServer sets the restServer on the option

func WithSleeper

func WithSleeper(sleeper clock.Sleeper) Option

WithSleeper sets the sleeper on the options

type Server

type Server interface {
	// Server traffic from the listener.
	Serve(net.Listener) error
}

Server is a point of use interface for a http.Server

Jump to

Keyboard shortcuts

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