server

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.0

type Config struct {
	Addr         string        `dm:"addr"`
	IdleTimeout  time.Duration `dm:"idle_timeout"`
	ReadTimeout  time.Duration `dm:"read_timeout"`
	WriteTimeout time.Duration `dm:"write_timeout"`
	CertFile     string        `dm:"cert_file"`
	KeyFile      string        `dm:"key_file"`
	CAFile       string        `dm:"ca_file"`
	//
	ErrorLog *log.Logger
	// contains filtered or unexported fields
}

func NewConfig added in v0.2.0

func NewConfig(opts ...Option) *Config

type Option

type Option func(*Config)

func WithAddr

func WithAddr(addr string) Option

func WithCAFile

func WithCAFile(caFile string) Option

func WithCertKeyFiles

func WithCertKeyFiles(certFile, keyFile string) Option

func WithErrorLogger

func WithErrorLogger(logger *log.Logger) Option

func WithIdleTimeout

func WithIdleTimeout(timeout time.Duration) Option

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) Option

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) Option

type Server

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

func New

func New(mux http.Handler, cfg *Config) (*Server, error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

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

Jump to

Keyboard shortcuts

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