web

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Port = ":8080"

Variables

This section is empty.

Functions

func MachineIP

func MachineIP() string

MachineIP returns the local (LAN) IP of the machine running the webserver

func RemoveSpaces

func RemoveSpaces(str string) string

RemoveSpaces efficiently trims spaces out of strings

func WriteHTTPMessage

func WriteHTTPMessage(w http.ResponseWriter, code int, msg string)

WriteHTTPMessage sets the header and returns a message for the failure

Types

type NeuteredFileSystem

type NeuteredFileSystem struct {
	FileSystem http.FileSystem
}

NeuteredFileSystem sets up a FileSystem to use with http.FilerServer

func (NeuteredFileSystem) Open

func (nfs NeuteredFileSystem) Open(path string) (http.File, error)

Open satisfies the filesystem interface Directory/filesystem "neutering" technique from https://www.alexedwards.net/blog/disable-http-fileserver-directory-listings

type Uploader

type Uploader struct {
	CurrentFile int    `json:"currentFile"`
	PathPrefix  string `json:"pathPrefix"`
}

Uploader is our handle to the server instance

func NewUploader

func NewUploader(pathPrefix string) Uploader

NewUploader returns an uploader object with a specific prefix to save files to

func (*Uploader) ReceiveHandler

func (u *Uploader) ReceiveHandler(w http.ResponseWriter, r *http.Request)

ReceiveHandler takes a filepond upload POST and copies the file to the filesystem

Jump to

Keyboard shortcuts

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