server

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanTempFile

func CleanTempFile(file *os.File)

func GetUpload

func GetUpload(r *http.Request) (file io.Reader, filename, contentType string, contentLength int64, err error)

func SanitizeFilename

func SanitizeFilename(filename string) string

func SendJSON

func SendJSON(w http.ResponseWriter, data interface{})

func SendPlain

func SendPlain(w http.ResponseWriter, data string)

func ShowInline

func ShowInline(contentType string) bool

func ValidateContentType

func ValidateContentType(h http.Header) bool

Types

type OptionFn

type OptionFn func(*Server)

func HTTPSOnly

func HTTPSOnly(httpsOnly bool) OptionFn

func MaxUploadSize

func MaxUploadSize(kbytes int64) OptionFn

func Port

func Port(port int) OptionFn

func RateLimit

func RateLimit(requests int) OptionFn

func UseStorage

func UseStorage(storage storage.Storage) OptionFn

type Server

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

func New

func New(options ...OptionFn) *Server

func (*Server) GetDownloadURL

func (s *Server) GetDownloadURL(r *http.Request, fileUrl *url.URL) string

func (*Server) Run

func (s *Server) Run()

Jump to

Keyboard shortcuts

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