server

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const TLSProxyOption = "https_dev_proxy"

Variables

This section is empty.

Functions

func LoadClientCertificate added in v1.11.0

func LoadClientCertificate(config *config.ClientCertificate) (tls.Certificate, tls.Certificate, error)

func LoadServerCertificate added in v1.11.0

func LoadServerCertificate(config *config.ServerCertificate) (tls.Certificate, error)

func NewTLSProxy

func NewTLSProxy(addr, port string, logger logrus.FieldLogger, settings *config.Settings) (*http.Server, error)

func SortPathPatterns added in v1.11.0

func SortPathPatterns(pathPatterns []string)

Types

type ErrorWrapper

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

ErrorWrapper logs incoming Write bytes with the context filled logrus.FieldLogger.

func (*ErrorWrapper) Write

func (e *ErrorWrapper) Write(p []byte) (n int, err error)

type HTTPServer

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

HTTPServer represents a configured HTTP server.

func New

func New(cmdCtx, evalCtx context.Context, log logrus.FieldLogger, settings *config.Settings,
	timings *runtime.HTTPTimings, p runtime.Port, hosts runtime.Hosts) (*HTTPServer, error)

New creates an HTTP(S) server with configured router and middlewares.

func NewServers added in v1.11.0

func NewServers(cmdCtx, evalCtx context.Context, log logrus.FieldLogger, settings *config.Settings,
	timings *runtime.HTTPTimings, srvConf runtime.ServerConfiguration) ([]*HTTPServer, func(), error)

NewServers returns a list of the created and configured HTTP(s) servers.

func (*HTTPServer) Addr

func (s *HTTPServer) Addr() string

Addr returns the listener address.

func (*HTTPServer) Close

func (s *HTTPServer) Close() error

Close closes the listener

func (*HTTPServer) Listen

func (s *HTTPServer) Listen() error

Listen initiates the configured http handler and start listing on given port.

func (*HTTPServer) ServeHTTP

func (s *HTTPServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type ListenPort

type ListenPort string

func (ListenPort) Port

func (lp ListenPort) Port() runtime.Port

type Mux

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

Mux is a http request router and dispatches requests to their corresponding http handlers.

func NewMux

func NewMux(options *runtime.MuxOptions) *Mux

func (*Mux) FindHandler

func (m *Mux) FindHandler(req *http.Request) http.Handler

func (*Mux) RegisterConfigured added in v1.11.1

func (m *Mux) RegisterConfigured()

type PEM added in v1.11.0

type PEM struct {
	Certificate []byte
	PrivateKey  []byte
}

type Ports

type Ports []string

func (Ports) Contains

func (tp Ports) Contains(needle string) bool

type SelfSignedCertificate added in v1.8.0

type SelfSignedCertificate struct {
	CA                            *tls.Certificate
	CACertificate                 PEM
	Server                        *tls.Certificate
	ServerCertificate             PEM
	ServerPrivateKey              []byte
	Client                        *tls.Certificate
	ClientCertificate             PEM
	ClientPrivateKey              []byte
	ClientIntermediateCertificate PEM
	ClientIntermediate            *tls.Certificate
}

func NewCertificate added in v1.8.0

func NewCertificate(duration time.Duration, hosts []string, notBefore *time.Time) (*SelfSignedCertificate, error)

NewCertificate creates a certificate with given hosts and duration. If no hosts are provided all localhost variants will be used.

type TLSDevPorts

type TLSDevPorts map[ListenPort]Ports

func (TLSDevPorts) Add

func (tdp TLSDevPorts) Add(pair string) error

func (TLSDevPorts) Get

func (tdp TLSDevPorts) Get(p string) []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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