http

package
v0.0.1-alpha.14 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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