server

package
v0.0.0-...-7370945 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrPasswordWithoutTLS is the error returned when using a password without TLS
	ErrPasswordWithoutTLS = errors.New("must use TLS if authorization is required")
)

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option is a functional option for configuring the server

func WithAuthHash

func WithAuthHash(value string) Option

WithAuthHash configures the server with authentication Also requires WithKeyPair for TLS

func WithBind

func WithBind(bind string) Option

WithBind sets the interface and port to bind the server to

func WithKeyPair

func WithKeyPair(certFile, keyFile string) Option

WithKeyPair confiures the server with a TLS key pair

func WithVersionedStore

func WithVersionedStore(value storage.VersionedStore) Option

WithVersionedStore sets the versioned store to use for the server

type Server

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

Server is the server implementation

func New

func New(opts ...Option) *Server

New constructs a new instance of the server with the provided options

func (*Server) Listen

func (s *Server) Listen() (addr string, err error)

Listen sets up the listening socket

func (*Server) Serve

func (s *Server) Serve() error

Serve listens and spawns a server goroutine for each incoming connection. The function will return (some time after) shutdown is called.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown instructs the server to shutdown. This method will return immediately, while the server will have to be considered shut down only when Serve returns.

Jump to

Keyboard shortcuts

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