server

package
v0.0.0-...-9edc64f Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

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

HTTPServer repreents a HTTP or HTTPS server

func NewServer

func NewServer(c *ServerConfig, handler http.Handler) (*HTTPServer, error)

NewServer create a Server instance

func (*HTTPServer) Shutdown

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

Shutdown closes the https server gracefully

func (*HTTPServer) Start

func (s *HTTPServer) Start() error

Start starts the https server and listens for new incoming requests

type ServerConfig

type ServerConfig struct {
	Port       int
	TLSEnabled bool
	// Timeouts
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
	// Certs
	TrustStore    string // List of trusted Client CA certificates
	ServerKey     string // Server's Private key
	ServerCert    string // Server's Certificate
	ServerCaCerts string // Server's CA certificate chain
}

ServerConfig represents the configuration of the crosswork Config

func (*ServerConfig) GetServerCaCerts

func (sc *ServerConfig) GetServerCaCerts() ([]byte, error)

func (*ServerConfig) GetServerCert

func (sc *ServerConfig) GetServerCert() ([]byte, error)

func (*ServerConfig) GetServerKey

func (sc *ServerConfig) GetServerKey() ([]byte, error)

func (*ServerConfig) GetTrustStore

func (sc *ServerConfig) GetTrustStore() ([]byte, error)

Jump to

Keyboard shortcuts

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