httpsrv

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg *Config, h http.Handler) *http.Server

New creates a standard HTTP server using the provided configuration and handler.

Types

type Config

type Config struct {
	Port         string        // Port on which the server listens
	ReadTimeout  time.Duration // Maximum duration for reading the entire request
	WriteTimeout time.Duration // Maximum duration before timing out writes
	IdleTimeout  time.Duration // Maximum time to wait for the next request
}

Config contains configuration settings for an server.

func NewConfig

func NewConfig(port string, read, write, idle time.Duration) *Config

func (*Config) WithIdleTimeout

func (c *Config) WithIdleTimeout(timeout time.Duration) *Config

WithIdleTimeout sets the IdleTimeout field and returns the updated Config.

func (*Config) WithPort

func (c *Config) WithPort(port string) *Config

WithPort sets the Port field and returns the updated Config.

func (*Config) WithReadTimeout

func (c *Config) WithReadTimeout(timeout time.Duration) *Config

WithReadTimeout sets the ReadTimeout field and returns the updated Config.

func (*Config) WithWriteTimeout

func (c *Config) WithWriteTimeout(timeout time.Duration) *Config

WithWriteTimeout sets the WriteTimeout field and returns the updated Config.

Jump to

Keyboard shortcuts

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