config

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHeaders = map[string]string{
	"Accept-Encodings": "identity",
}

Functions

This section is empty.

Types

type Body

type Body struct {
	// MaxSize describes the maximal size of a body, that can be processed. 0 will discard
	// any request with body (each call to request's body will result in status.ErrBodyTooLarge)
	MaxSize uint
	// MaxChunkSize is responsible for a maximal size of a single chunk being transferred
	// via chunked TE
	MaxChunkSize int64
	// DecodingBufferSize is a size of a buffer, used to store decoded request's body
	DecodingBufferSize int64
}

type Config

type Config struct {
	URL     URL
	Headers Headers
	Body    Body
	HTTP    HTTP
	TCP     TCP
}

func Default

func Default() Config

Default returns default config. Those are initially well-balanced, however maximal defaults are pretty permitting

func Fill

func Fill(src Config) (new Config)

Fill fills zero-values from partially-filled Config instance with default ones

type HTTP

type HTTP struct {
	// ResponseBuffSize is responsible for a response buffer that is being allocated when
	// client connects and is used for rendering the response into it
	ResponseBuffSize int
	// FileBuffSize defines the size of the read buffer when reading a file
	FileBuffSize int
}

type Headers

type Headers struct {
	// Number is responsible for headers map size.
	// Default value is an initial size of allocated headers map.
	// Maximal value is maximum number of headers allowed to be presented
	Number HeadersNumber
	// MaxKeyLength is responsible for maximal header key length restriction.
	MaxKeyLength int
	// MaxValueLength is responsible for maximal header value length restriction.
	MaxValueLength int
	// KeySpace is responsible for limitation of how much space can headers' keys
	// consume. Default value is how many bytes to pre-allocate, and maximal is
	// how many bytes can be stored maximally
	KeySpace HeadersKeysSpace
	// HeadersValuesSpace is responsible for a maximal space in bytes available for
	// keeping header values in memory.
	// Default value is initial space allocated when client connects.
	// Maximal value is a hard limit, reaching which one client triggers server
	// to response with 431 Header Fields Too Large
	ValueSpace HeadersValuesSpace
	// MaxEncodingTokens is a limit of how many encodings can be applied at the body
	// for a single request
	MaxEncodingTokens int
	// Default headers are those, which will be rendered on each response unless they were
	// not overridden by user
	Default map[string]string
	// CookiesPreAllocate defines the size of keyvalue.Storage, which is used to store cookies
	// once on demand. Therefore, it's going to be allocated only if used
	CookiesPreAllocate int
}

type HeadersKeysSpace

type HeadersKeysSpace struct {
	Default, Maximal int
}

type HeadersNumber

type HeadersNumber struct {
	Default, Maximal int
}

type HeadersValuesSpace

type HeadersValuesSpace struct {
	Default, Maximal int
}

type Query

type Query struct {
	PreAlloc int
}

type TCP

type TCP struct {
	// ReadBufferSize is a size of buffer in bytes which will be used to read from
	// socket
	ReadBufferSize int
	// ReadTimeout is a duration after which client will be automatically disconnected
	ReadTimeout time.Duration
}

type URL

type URL struct {
	// MaxLength is a size for buffer that'll be allocated once and will be kept
	// until client disconnect
	BufferSize URLBufferSize
	Query      Query
}

type URLBufferSize

type URLBufferSize struct {
	Default, Maximal int
}

Jump to

Keyboard shortcuts

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