routes

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FaviconContentType = "image/x-icon"
)

Variables

View Source
var Favicon []byte

Functions

func ServeAuthCheck

func ServeAuthCheck(ctx *fasthttp.RequestCtx)

ServeAuthCheck validates the master key by calling IsAuthorized.

func ServeFavicon

func ServeFavicon(ctx *fasthttp.RequestCtx)

ServeFavicon returns the favicon's image.

func ServeFile

func ServeFile(ctx *fasthttp.RequestCtx)

ServeFile will serve the / endpoint. It gets the "id" variable from mux and tries to find the file's information in the database. If an ID is either not provided or not found, the function hands the request off to ServeNotFound.

func ServeNotFound

func ServeNotFound(ctx *fasthttp.RequestCtx)

ServeNotFound will always return an HTTP status code of 404 + error message text.

func ServeStats

func ServeStats(ctx *fasthttp.RequestCtx)

ServeStats serves stats. StatsFromSizeChecker are populated into redis by https://github.com/vysiondev/size-checker.

func ServeUpload

func ServeUpload(ctx *fasthttp.RequestCtx)

ServeUpload handles all incoming POST requests to /upload. It will take a multipart form, parse the file, then write it to disk.

Types

type GeneralStats

type GeneralStats struct {
	ServerVersion  string               `json:"server_version"`
	RuntimeVersion string               `json:"runtime_version,omitempty"`
	MemoryUsage    int64                `json:"memory_usage,omitempty"`
	SizeStats      StatsFromSizeChecker `json:"size_stats"`
}

GeneralStats represent all stats returned when making a GET request to /stats.

type StatsFromSizeChecker

type StatsFromSizeChecker struct {
	TotalSize      int64 `json:"total_size"`
	FileCount      int64 `json:"file_count"`
	TimeToComplete int64 `json:"time_to_complete"`
	LastUpdated    int64 `json:"last_updated"`
}

StatsFromSizeChecker represent all stats returned by an external size checker program.

Jump to

Keyboard shortcuts

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