httpserver

package
v0.0.4-dev Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr string

	// if non-empty, a fixed status code returned for all requests
	// when zero, defaults to 200
	StatusCode int
}

type FakeHandler

type FakeHandler struct {
	// if non-zero, forces this status code for all responses.
	StatusCode int
}

func (FakeHandler) ServeHTTP

func (h FakeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Handler

type Handler struct {
	StatusCode int
}

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Server

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

func New

func New(conf Config, handler http.Handler) (*Server, error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS(certFile, keyFile string) error

func (*Server) Serve

func (s *Server) Serve(l net.Listener) error

func (*Server) SetTLSConfig

func (s *Server) SetTLSConfig(conf *tls.Config)

func (*Server) Shutdown

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

Jump to

Keyboard shortcuts

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