httputil

package
v2.0.6 Latest Latest
Warning

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

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

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

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

NewServer creates a HTTP server with time out settings.

Types

type ServerOption

type ServerOption func(*serverConfig)

ServerOption is a server option

func ReadHeaderTimeout

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