httputil

package
v1.12.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServerConfig = serverConfig{
	ReadHeaderTimeout: 5 * time.Second,
	ReadTimeout:       30 * time.Second,
	WriteTimeout:      30 * time.Second,
	IdleTimeout:       120 * time.Second,
}

DefaultServerConfig is the default server config

Functions

func LimitListener

func LimitListener(addr string) (net.Listener, error)

LimitListener creates a tcp keep-alive listener with 400 maximum connections.

func NewServer added in v1.8.4

func NewServer(addr string, handler http.Handler, opts ...ServerOption) http.Server

NewServer creates a HTTP server with time out settings.

Types

type ServerOption added in v1.8.4

type ServerOption func(*serverConfig)

ServerOption is a server option

func ReadHeaderTimeout added in v1.8.4

func ReadHeaderTimeout(h time.Duration) ServerOption

ReadHeaderTimeout sets header timeout

Jump to

Keyboard shortcuts

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