gracehttp

package
v1.8.13 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReadTimeout  = 60 * time.Second
	DefaultWriteTimeout = DefaultReadTimeout

	EnvDebug = "debug"
	EnvTest  = "test"
	EnvStage = "stage"
	EnvProd  = "prod"
)
View Source
const (
	GracefulEnvironKey    = "IS_GRACEFUL"
	GracefulEnvironString = GracefulEnvironKey
	GracefulListenerFd    = 3
	OcspDefaultExpire     = time.Minute * 10
)

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string, handler http.Handler) error

ListenAndServe http

func ListenAndServeTLS

func ListenAndServeTLS(addr string, certFile string, keyFile string, handler http.Handler) error

ListenAndServeTLS https

func SetEnv

func SetEnv(mode string)

Types

type Server

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

Server HTTP server that supported graceful shutdown or restart

func NewServer

func NewServer(addr string, handler http.Handler, readTimeout, writeTimeout time.Duration) *Server

func (*Server) GetCertificateWithOcsp

func (srv *Server) GetCertificateWithOcsp(*tls.ClientHelloInfo) (*tls.Certificate, error)

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe() error

func (*Server) ListenAndServeTLS

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

func (*Server) ListenAndServeTLSOcsp

func (srv *Server) ListenAndServeTLSOcsp(expire time.Duration, certFile, keyFile string) error

func (*Server) Serve

func (srv *Server) Serve() error

Jump to

Keyboard shortcuts

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