svr

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package svr contains generic server startup/shutdown code, currently for running HTTP servers, but can also add in GRPC etc down the line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Logger        *zap.Logger
	RequestLogger *zap.Logger
}

Options are options to a server.

type Server

type Server interface {
	AddHTTPEndpoint(name string, _ netx.HostPort, _ http.Handler, _ *TLSOptions) Server
	EndpointURL(name string) string
	Start(_ context.Context) error
	Stop(_ context.Context) error
	Run(_ context.Context) error
	WaitForShutdown(_ context.Context) error
}

A Server is a server mainline.

func New

func New(log *zap.Logger) (Server, error)

New creates a new server.

type TLSOptions

type TLSOptions struct {
	Config   *tls.Config
	CertFile string
	KeyFile  string
}

TLSOptions are options for transport layer security.

func (*TLSOptions) Copy

func (opts *TLSOptions) Copy() *TLSOptions

Copy creates a copy of the TLSOptions.

Jump to

Keyboard shortcuts

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