http

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServeMux

type ServeMux struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ServeMux is our HTTP request multiplexer with removable handlers.

func NewServeMux

func NewServeMux() *ServeMux

NewServeMux create a new HTTP request multiplexer.

func (*ServeMux) Handle

func (mux *ServeMux) Handle(pattern string, handler http.Handler)

Handle registers a handler for the given pattern.

func (*ServeMux) HandleFunc

func (mux *ServeMux) HandleFunc(pattern string, fn func(http.ResponseWriter, *http.Request))

HandleFunc registers a handler function for the given pattern.

func (*ServeMux) ServeHTTP

func (mux *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves a HTTP request.

func (*ServeMux) Unregister

func (mux *ServeMux) Unregister(pattern string) (http.Handler, bool)

Unregister unregister any handlers for the given pattern.

type Server

type Server struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Server is our HTTP server, with support for unregistering handlers.

func NewServer

func NewServer() *Server

NewServer creates a new server instance.

func (*Server) GetAddress

func (s *Server) GetAddress() string

GetAddress returns the current server HTTP endpoint/address.

func (*Server) GetMux

func (s *Server) GetMux() *ServeMux

GetMux returns the mux for this server.

func (*Server) Reconfigure

func (s *Server) Reconfigure(addr string) error

Reconfigure reconfigures the server.

func (*Server) Restart

func (s *Server) Restart(addr string) error

Restart restarts it on the given address.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP servers the given HTTP request.

func (*Server) Shutdown

func (s *Server) Shutdown(wait bool)

Shutdown shuts down the server gracefully.

func (*Server) Start

func (s *Server) Start(addr string) error

Start sets up the server to listen and serve on the given address.

func (*Server) Stop

func (s *Server) Stop()

Stop Close()'s the server immediately.

Jump to

Keyboard shortcuts

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