Help us shape the future of Go! Take the 2026 Go Developer Survey

httpserver

package
v1.45.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package httpserver implements HTTP server.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTLSCertKeyMismatch = errors.New("tls cert/key mismatch: both certFile and keyFile must be set when TLS is enabled")
)

Errors.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

Option -.

func Listener added in v1.13.0

func Listener(l net.Listener) Option

Listener injects a pre-bound listener (useful for tests to avoid binding real ports).

func Logger added in v1.13.0

func Logger(l appLogger.Interface) Option

Logger injects a logger to be used by the HTTP server internals.

func Port

func Port(host, port string) Option

Port -.

func ReadTimeout

func ReadTimeout(timeout time.Duration) Option

ReadTimeout -.

func ShutdownTimeout

func ShutdownTimeout(timeout time.Duration) Option

ShutdownTimeout -.

func TLS added in v1.13.0

func TLS(enable bool, certFile, keyFile string) Option

TLS enables TLS and optionally sets cert and key file paths.

func WriteTimeout

func WriteTimeout(timeout time.Duration) Option

WriteTimeout -.

type Server

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

Server -.

func New

func New(handler http.Handler, opts ...Option) *Server

New -.

func (*Server) Notify

func (s *Server) Notify() <-chan error

Notify -.

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown -.

Jump to

Keyboard shortcuts

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