httpserver

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 12 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

This section is empty.

Types

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 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
	MaxFileSize       int // 50Mb
}

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