Documentation ¶
Index ¶
- Constants
- Variables
- func ServeAuthCheck(ctx *fasthttp.RequestCtx)
- func ServeFavicon(ctx *fasthttp.RequestCtx)
- func ServeFile(ctx *fasthttp.RequestCtx)
- func ServeNotFound(ctx *fasthttp.RequestCtx)
- func ServeStats(ctx *fasthttp.RequestCtx)
- func ServeUpload(ctx *fasthttp.RequestCtx)
- type GeneralStats
- type StatsFromSizeChecker
Constants ¶
const (
FaviconContentType = "image/x-icon"
)
Variables ¶
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.