webserver

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_REQUEST_SIZE_MEMORY = 1 << 20
	MAX_REQUEST_SIZE_TOTAL  = 1 << 30
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name          string
	Port          string
	TLSDisabled   bool
	TLSPort       string
	TLSPrivateKey string
	TLSPublicKey  string
	WebRoot       string
	Index         string
	MimeTypes     map[string]string
	DefaultMime   string
	ErrorMime     string
	Timeouts      Timeouts
}

* Data structure for web server configuration.

type HttpRequest

type HttpRequest struct {
	Protocol string
	Method   string
	Path     string
	Host     string
	Params   map[string]string
	Files    map[string][]multipart.File
	Respond  chan<- HttpResponse
}

* Exchange format for HTTP requests.

type HttpResponse

type HttpResponse struct {
	Header                map[string]string
	Body                  []byte
	ContentReadCloser     io.ReadCloser
	ContentReadSeekCloser io.ReadSeekCloser
}

* Exchange format for HTTP responses.

type ProtocolTimeouts

type ProtocolTimeouts struct {
	Header uint32
	Read   uint32
	Write  uint32
	Idle   uint32
}

* Data structure representing protocol timeouts. * * All numbers are provided in seconds. * * A value of zero represents no timeout.

type Timeouts

type Timeouts struct {
	HTTP ProtocolTimeouts
	TLS  ProtocolTimeouts
}

* Data structure representing timeouts for multiple protocols.

type WebServer

type WebServer interface {
	RegisterCgi(path string) <-chan HttpRequest
	GetCgis() []string
	RemoveCgi(path string)
	Run()
}

* The public interface of the web server.

func CreateWebServer

func CreateWebServer(cfg Config) WebServer

* Creates a new web server.

Jump to

Keyboard shortcuts

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