httpserver

package
v0.0.0-...-d5dcd45 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package httpserver provides a simple HTTP server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

Option is a functional option for configuring a Server.

func WithHost

func WithHost(host string) Option

WithHost sets the host for the server.

func WithMaxHeaderBytes

func WithMaxHeaderBytes(maxHeaderBytes int) Option

WithMaxHeaderBytes sets the max header bytes for the server.

func WithPort

func WithPort(port string) Option

WithPort sets the port for the server.

func WithReadHeaderTimeout

func WithReadHeaderTimeout(readHeaderTimeout time.Duration) Option

WithReadHeaderTimeout sets the read header timeout for the server.

func WithReadTimeout

func WithReadTimeout(readTimeout time.Duration) Option

WithReadTimeout sets the read timeout for the server.

func WithWriteTimeout

func WithWriteTimeout(writeTimeout time.Duration) Option

WithWriteTimeout sets the write timeout for the server.

type Server

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

Server is a simple HTTP server.

func New

func New(httpHandler http.Handler, opts ...Option) Server

New creates a new Server.

func (Server) Start

func (s Server) Start() error

Start starts the http server.

func (Server) Stop

func (s Server) Stop(ctx context.Context, shutdownTimeout time.Duration) error

Stop stops the http server.

Jump to

Keyboard shortcuts

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