server

package
v0.0.0-...-1056671 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(cfg Config, log Logger, h http.Handler, listening ...chan net.Addr) error

Types

type Config

type Config struct {
	Host    string `envconfig:"HOST" default:""`
	Port    int    `envconfig:"PORT" default:"8080"`
	Timeout struct {
		Handler    time.Duration `envconfig:"TIMEOUT_HANDLER" default:"10s"`
		Idle       time.Duration `envconfig:"TIMEOUT_IDLE"`
		Read       time.Duration `envconfig:"TIMEOUT_READ"`
		ReadHeader time.Duration `envconfig:"TIMEOUT_READ_HEADER" default:"2s"`
		Shutdown   time.Duration `envconfig:"TIMEOUT_SHUTDOWN" default:"5s"`
		Write      time.Duration `envconfig:"TIMEOUT_WRITE"`
	}
	TLS struct {
		Enabled  bool   `envconfig:"TLS_ENABLED"`
		CertFile string `envconfig:"TLS_CERT_FILE"`
		KeyFile  string `envconfig:"TLS_KEY_FILE"`
	}
}

func (*Config) ListenAddr

func (c *Config) ListenAddr() string

func (*Config) ReadTimeout

func (c *Config) ReadTimeout() time.Duration

func (*Config) WriteTimeout

func (c *Config) WriteTimeout() time.Duration

type Logger

type Logger interface {
	Error(msg string, args ...any)
	Info(msg string, args ...any)
}

Jump to

Keyboard shortcuts

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