web

package
v5.10.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultAddress is the default address the application will bind to
	DefaultAddress = "0.0.0.0"

	// DefaultPort is the default port the application will listen on
	DefaultPort = 8080

	// DefaultReadBufferSize is the default value for ReadBufferSize
	DefaultReadBufferSize = 8192

	// MinimumReadBufferSize is the minimum value for ReadBufferSize, and also the default value set
	// for fiber.Config.ReadBufferSize
	MinimumReadBufferSize = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Address to listen on (defaults to 0.0.0.0 specified by DefaultAddress)
	Address string `yaml:"address"`

	// Port to listen on (default to 8080 specified by DefaultPort)
	Port int `yaml:"port"`

	// ReadBufferSize sets fiber.Config.ReadBufferSize, which is the buffer size for reading requests coming from a
	// single connection and also acts as a limit for the maximum header size.
	//
	// If you're getting occasional "Request Header Fields Too Large", you may want to try increasing this value.
	//
	// Defaults to DefaultReadBufferSize
	ReadBufferSize int `yaml:"read-buffer-size,omitempty"`

	// TLS configuration (optional)
	TLS *TLSConfig `yaml:"tls,omitempty"`
}

Config is the structure which supports the configuration of the server listening to requests

func GetDefaultConfig

func GetDefaultConfig() *Config

GetDefaultConfig returns a Config struct with the default values

func (*Config) HasTLS added in v5.5.1

func (web *Config) HasTLS() bool

func (*Config) SocketAddress

func (web *Config) SocketAddress() string

SocketAddress returns the combination of the Address and the Port

func (*Config) ValidateAndSetDefaults

func (web *Config) ValidateAndSetDefaults() error

ValidateAndSetDefaults validates the web configuration and sets the default values if necessary.

type TLSConfig added in v5.4.0

type TLSConfig struct {
	// CertificateFile is the public certificate for TLS in PEM format.
	CertificateFile string `yaml:"certificate-file,omitempty"`

	// PrivateKeyFile is the private key file for TLS in PEM format.
	PrivateKeyFile string `yaml:"private-key-file,omitempty"`
}

Jump to

Keyboard shortcuts

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