server

package
v0.0.0-...-8be6c9d Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPListener

type HTTPListener struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *HTTPListener

func (*HTTPListener) Listen

func (s *HTTPListener) Listen(ctx context.Context, handler http.Handler) error

type Logger

type Logger interface {
	Debug(args ...interface{})
	Error(args ...interface{})
	Warn(args ...interface{})
}

type Mux

type Mux interface {
	http.Handler
	Handle(string, http.Handler)
}

type Option

type Option func(*options)

func WithIdleTimeout

func WithIdleTimeout(timeout time.Duration) Option

WithIdleTimeout sets the maximum amount of time to wait for the next request.

func WithLogger

func WithLogger(logger Logger) Option

func WithOnShutdown

func WithOnShutdown(f func()) Option

func WithPort

func WithPort(port int) Option

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) Option

WithReadTimeout sets the maximum duration for reading the entire request, including the body.

func WithShutdownTimeout

func WithShutdownTimeout(timeout time.Duration) Option

WithShutdownTimeout sets the maximum duration for graceful shutdown (0 is no timeout).

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) Option

WithWriteTimeout sets the maximum duration before timing out writes of the response.

Jump to

Keyboard shortcuts

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