util

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: GPL-3.0, GPL-3.0-or-later Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorHashingFailed is returned if the hashing of the provided path fails
	ErrorHashingFailed = errors.New("hhashing the provided path failed")
)

Functions

func FormatBaseAddress added in v1.0.7

func FormatBaseAddress(c *config.Config, r *http.Request) string

FormatBaseAddress returns the public base address of the server given the server config it ignores the port if it's default for the given protocol

func GenerateZBase32RandomPath

func GenerateZBase32RandomPath(length int) string

GenerateZBase32RandomPath generates a file path for Human ease using z-base-32

func HashForPath

func HashForPath(path string) (string, error)

HashForPath generates a hash used to store the file so that the user-generated path is not stored or used

func StatusCoder

func StatusCoder(h http.HandlerFunc, c *config.Config) http.HandlerFunc

StatusCoder logs status code of request after it completes

func WriteFaviconPNG

func WriteFaviconPNG(w http.ResponseWriter)

WriteFaviconPNG writes favIcon PNG bytes to the supplised ResponseWriter

Types

type P

type P struct {
	X int
	Y int
}

P holds a pixel, and its name is shorter than Pixel :D

Jump to

Keyboard shortcuts

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