httpserver

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package httpserver contains the http server logic

Index

Constants

This section is empty.

Variables

View Source
var (
	EnableUpload  bool
	EnableVerbose bool
)

Convenience globals

Functions

func PythonStyle added in v0.0.6

func PythonStyle(root http.Dir) http.Handler

Types

type HTTPHeader added in v0.0.6

type HTTPHeader struct {
	Name  string
	Value string
}

HTTPHeader represents an HTTP header

type HTTPServer

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

HTTPServer instance

func New

func New(options *Options) (*HTTPServer, error)

New http server instance with options

func (*HTTPServer) Close

func (t *HTTPServer) Close() error

Close the service

func (*HTTPServer) ListenAndServe

func (t *HTTPServer) ListenAndServe() error

ListenAndServe requests over http

func (*HTTPServer) ListenAndServeTLS

func (t *HTTPServer) ListenAndServeTLS() error

ListenAndServeTLS requests over https

type Middleware added in v0.0.5

type Middleware func(http.Handler) http.Handler

LayerHandler is the interface of all layer funcs

type Options

type Options struct {
	Folder            string
	EnableUpload      bool
	ListenAddress     string
	TLS               bool
	Certificate       string
	CertificateKey    string
	CertificateDomain string
	BasicAuthUsername string
	BasicAuthPassword string
	BasicAuthReal     string
	Verbose           bool
	Sandbox           bool
	HTTP1Only         bool
	MaxFileSize       int // 50Mb
	MaxDumpBodySize   int64
	Python            bool
	CORS              bool
	HTTPHeaders       []HTTPHeader
}

Options of the http server

type SandboxFileSystem added in v0.0.4

type SandboxFileSystem struct {
	RootFolder string
	// contains filtered or unexported fields
}

SandboxFileSystem implements superbasic security checks

func (SandboxFileSystem) Open added in v0.0.4

func (sbfs SandboxFileSystem) Open(path string) (http.File, error)

Open performs basic security checks before providing folder/file content

Jump to

Keyboard shortcuts

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