http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(ctx context.Context, s *Server) error

Types

type Server

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

func NewServer

func NewServer(serverConf *ServerConfig, handler http.Handler) *Server

func (*Server) Close

func (server *Server) Close()

func (*Server) ListenAndServe

func (server *Server) ListenAndServe() error

func (*Server) Serve

func (server *Server) Serve(listener net.Listener) error

type ServerConfig

type ServerConfig struct {
	Addr              string           `mapstructure:"addr" validate:"required,hostname_port"`
	GracefulTimeout   time.Duration    `mapstructure:"gracefulTimeout" validate:"required"`
	ReadTimeout       time.Duration    `mapstructure:"readTimeout" validate:"gte=0"`
	ReadHeaderTimeout time.Duration    `mapstructure:"readHeaderTimeout" validate:"gte=0"`
	TLS               *ServerTLSConfig `mapstructure:"tls"`
}

type ServerTLSConfig

type ServerTLSConfig struct {
	Cert string `mapstructure:"cert" validate:"required,file"`
	Key  string `mapstructure:"key" validate:"required,file"`
}

Jump to

Keyboard shortcuts

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