lib

package
v0.0.0-...-0b93e99 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(dst, src string) error

CopyDir copies the content of src to dst. src should be a full path.

func FileExists

func FileExists(filename string) bool

FileExists does?

func InjectVarsIntoIndex

func InjectVarsIntoIndex(indexFile []byte, entryFileName, assetsDir, publicUrl string) ([]byte, bool)

InjectVarsIntoIndex injects js/css import to index.html content, returns bool if injected into content

func IsErrorAddressAlreadyInUse

func IsErrorAddressAlreadyInUse(err error) bool

IsErrorAddressAlreadyInUse checks if the error is bind: address already in use OR alternative

func PipedFileServer

func PipedFileServer(baseDir string, pipe http.HandlerFunc) http.HandlerFunc

PipedFileServer wraps your http.FileServer with neutered fs to remove dir browsing and pipes 404 to next handler

func PipedFileServerWithMiddleware

func PipedFileServerWithMiddleware(baseDir string, pipe http.HandlerFunc, middleware func(http.HandlerFunc) http.HandlerFunc) http.HandlerFunc

PipedFileServerWithMiddleware wraps PipedFileServer with middleware

func RealQuickPath

func RealQuickPath(fpath string) string

RealQuickPath just quickly gets path, without caring about errors

func Realpath

func Realpath(fpath string) (string, error)

Realpath returns the real path of a given file in the os

func WrappedFileServer

func WrappedFileServer(baseDir string) http.HandlerFunc

WrappedFileServer wraps your http.FileServer with neutered fs to remove dir browsing and redirects 404 to index.html

Types

type Broker

type Broker struct {
	// Events are pushed to this channel by the main events-gathering routine
	Notifier chan []byte
	// contains filtered or unexported fields
}

A Broker holds open client connections, listens for incoming events on its Notifier channel and broadcast event data to all registered connections

func NewStreamServer

func NewStreamServer() (broker *Broker)

func (*Broker) ServeHTTP

func (broker *Broker) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type NotFoundRedirectRespWr

type NotFoundRedirectRespWr struct {
	http.ResponseWriter // We embed http.ResponseWriter
	// contains filtered or unexported fields
}

NotFoundRedirectRespWr response for neutered fs

func (*NotFoundRedirectRespWr) Write

func (w *NotFoundRedirectRespWr) Write(p []byte) (int, error)

func (*NotFoundRedirectRespWr) WriteHeader

func (w *NotFoundRedirectRespWr) WriteHeader(status int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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