http

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultReadHeaderTimeout defines the default timeout for reading headers.
	DefaultReadHeaderTimeout = 2 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Acme              bool
	Port              int
	Cert              string
	Key               string
	AcmeHost          string
	ReadHeaderTimeout time.Duration
}

Config defines the config of an http server. TODO: expose via options?

type Server

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

Server is a wrapper around http.Server that exposes different async ListenAndServe methods that return corresponding ShutdownFunctions.

func NewServer

func NewServer(config Config, handler http.Handler) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() (*errgroup.Group, ShutdownFunction)

ListenAndServe initializes a server to respond to HTTP network requests.

func (*Server) ListenAndServeMTLS

func (s *Server) ListenAndServeMTLS() (*errgroup.Group, ShutdownFunction)

type ShutdownFunction

type ShutdownFunction func(context.Context) error

ShutdownFunction defines a function that is called to shutdown the server.

Jump to

Keyboard shortcuts

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