httpx

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotFound

func NotFound(w ResponseWriter)

Types

type Handler

type Handler = http.Handler

type HandlerFunc

type HandlerFunc = http.HandlerFunc

type Listener

type Listener struct {
	net.Listener
}

func NewListener

func NewListener(address string, withNextFreePort bool) (*Listener, error)

func (Listener) GetPort

func (l Listener) GetPort() int

type Mux

type Mux struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

func NewServeMux

func NewServeMux(prefix string) *Mux

NewServeMux allocates and returns a new ServeMux.

func (*Mux) Handle

func (m *Mux) Handle(pattern string, handler Handler) *Mux

func (*Mux) HandleFunc

func (m *Mux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) *Mux

func (*Mux) HandleW

func (m *Mux) HandleW(pattern string, h func(http.ResponseWriter)) *Mux

func (*Mux) Prefix

func (m *Mux) Prefix(v string)

func (*Mux) ServeHTTP

func (m *Mux) ServeHTTP(w ResponseWriter, r *Request)

func (*Mux) Static

func (m *Mux) Static(prefix string, path string) *Mux

type Option

type Option func(*Options)

func HttpsRedirect

func HttpsRedirect(redirect bool) Option

func WithLogger

func WithLogger(log *logger.Logger) Option

func WithPortRoll

func WithPortRoll(roll bool) Option

func WithServerConfig

func WithServerConfig(conf shared.Server) Option

func WithZone

func WithZone(zone string) Option

type Options

type Options struct {
	Https                bool
	HttpsRedirect        bool
	HttpsRedirectAddress string
	HttpsCert            string
	HttpsKey             string
	HttpsDomain          string
	PortRoll             bool
	IdleTimeout          time.Duration
	ReadTimeout          time.Duration
	WriteTimeout         time.Duration
	Logger               *logger.Logger
	Zone                 string
}

func (*Options) IsAutoHttpsCert

func (o *Options) IsAutoHttpsCert() bool

type Request

type Request = http.Request

type ResponseWriter

type ResponseWriter = http.ResponseWriter

type Server

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

func NewServer

func NewServer(address string, handler func(*Server) Handler, options ...Option) (*Server, error)

func (*Server) GetHost

func (s *Server) GetHost() string

func (*Server) GetProtocol

func (s *Server) GetProtocol() string

func (*Server) Mux

func (s *Server) Mux() *Mux

func (*Server) MuxX

func (s *Server) MuxX(prefix string) *Mux

func (*Server) Run

func (s *Server) Run()

func (*Server) Stop

func (s *Server) Stop() error

type TLS

type TLS struct {
	CertManager *autocert.Manager
}

func NewTLSConfig

func NewTLSConfig(host string) *TLS

Jump to

Keyboard shortcuts

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