webserver

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUEST_SIZE = 1 << 20
)

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
}

* Exchange format for HTTP responses.

type ProtocolTimeouts added in v1.6.1

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 added in v1.6.1

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