server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientAuthType

type ClientAuthType string
const (
	// No mTLS
	ClientAuthNone ClientAuthType = "none"
	// Client cert verified if provided
	ClientAuthWant ClientAuthType = "want"
	// Client cert required and verified
	ClientAuthNeed ClientAuthType = "need"
	// Any client cert will do
	ClientAuthAny ClientAuthType = "any"
	// Request client cert
	ClientAuthRequest ClientAuthType = "request"
)

type Server

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

func NewServer

func NewServer(config *ServerConfig) *Server

func (*Server) Shutdown

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

func (*Server) Start

func (s *Server) Start(router http.Handler) error

Start starts the server on the configured port

type ServerConfig

type ServerConfig struct {
	Host string `yaml:"host"`
	Port uint32 `yaml:"port"`
	Ssl  Ssl    `yaml:"ssl"`
}

func (*ServerConfig) GetAddr

func (s *ServerConfig) GetAddr() string

type Ssl

type Ssl struct {
	// Enable SSL
	Enabled bool `yaml:"enabled"`
	// Certificate file, can be just a PEM of cert + key or just the cert in which case you'll also need
	// to provide the key file
	CertFile string `yaml:"certFile"`
	// Key file if the cert file doesn't provide it
	KeyFile string `yaml:"keyFile"`
	// Key password if the key is encrypted
	KeyPassword string `yaml:"keyFilePassword"`
	// when using mTLS, CA PEM. If not provided, it will default to the certificate of the server as a CA
	CAcertFile string `yaml:"cacertFile"`
	// Client auth requested (none, want, need, any, request)
	ClientAuth ClientAuthType `yaml:"clientAuth"`
}

Jump to

Keyboard shortcuts

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