server

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFlags added in v0.70.0

func RegisterFlags(fs *flag.FlagSet, c *Config)

Types

type Config added in v0.70.0

type Config struct {
	ListenAddress string
	EnableHTTP2   bool
	TLSConfig     TLSConfig
}

Config defines the web server configuration.

func DefaultConfig added in v0.70.0

func DefaultConfig(listenAddress string, enableTLS bool) Config

type Server added in v0.70.0

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

Server is a web server.

func NewServer added in v0.70.0

func NewServer(logger log.Logger, c *Config, handler http.Handler) (*Server, error)

NewServer initializes a web server with the given handler (typically an http.MuxServe).

func (*Server) Serve added in v0.70.0

func (s *Server) Serve(ctx context.Context) error

Serve starts the web server. It will block until the server is shutted down or an error occurs.

func (*Server) Shutdown added in v0.70.0

func (s *Server) Shutdown(ctx context.Context) error

Shutdown closes gracefully all active connections.

type TLSConfig added in v0.70.0

type TLSConfig struct {
	Enabled        bool
	CertFile       string
	KeyFile        string
	ClientCAFile   string
	MinVersion     string
	CipherSuites   operator.StringSet
	ReloadInterval time.Duration
}

TLSConfig defines the TLS settings of the web server.

func (*TLSConfig) Convert added in v0.70.0

func (tc *TLSConfig) Convert(logger log.Logger) (*tls.Config, error)

Convert returns a *tls.Config from the given TLSConfig. It returns nil when TLS isn't enabled/configured.

Jump to

Keyboard shortcuts

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