server

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const TLSProxyOption = "https_dev_proxy"

Variables

This section is empty.

Functions

func LoadClientCertificate

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

func LoadServerCertificate

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

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

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

func (m *Mux) RegisterConfigured()

type PEM

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

type Ports

type Ports []string

func (Ports) Contains

func (tp Ports) Contains(needle string) bool

type SelfSignedCertificate

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

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