Documentation ¶
Index ¶
Constants ¶
const ( // DefaultShutdownTimeout - default shutdown timeout used for graceful http server shutdown. DefaultShutdownTimeout = 5 * time.Second // DefaultTCPKeepAliveTimeout - default TCP keep alive timeout for accepted connection. DefaultTCPKeepAliveTimeout = 10 * time.Second // DefaultReadTimeout - default timout to read data from accepted connection. DefaultReadTimeout = 30 * time.Second // DefaultWriteTimeout - default timout to write data to accepted connection. DefaultWriteTimeout = 30 * time.Second // DefaultMaxHeaderBytes - default maximum HTTP header size in bytes. DefaultMaxHeaderBytes = 1 * humanize.MiByte )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufConn ¶
type BufConn struct { QuirkConn // contains filtered or unexported fields }
BufConn - is a generic stream-oriented network connection supporting buffered reader and read/write timeout.
func (*BufConn) Peek ¶
Peek - returns the next n bytes without advancing the reader. It just wraps bufio.Reader.Peek().
func (*BufConn) RemoveTimeout ¶
func (c *BufConn) RemoveTimeout()
RemoveTimeout - removes all configured read and write timeouts. Used by callers which control net.Conn behavior themselves.
type QuirkConn ¶
QuirkConn - similar to golang net.Conn struct, but contains a workaround of the following the go bug reported here https://github.com/golang/go/issues/21133. Once the bug will be fixed, we can remove this structure and replaces it with the standard net.Conn
type Server ¶
type Server struct { http.Server Addrs []string // addresses on which the server listens for new connection. ShutdownTimeout time.Duration // timeout used for graceful server shutdown. TCPKeepAliveTimeout time.Duration // timeout used for underneath TCP connection. UpdateBytesReadFunc func(int) // function to be called to update bytes read in bufConn. UpdateBytesWrittenFunc func(int) // function to be called to update bytes written in bufConn. ErrorLogFunc func(error, string, ...interface{}) // function to be called on errors. // contains filtered or unexported fields }
Server - extended http.Server supports multiple addresses to serve and enhanced connection handling.