Documentation
¶
Overview ¶
Package askimage is THE rule for what an officer's ask image may be: the types HQ accepts (sniffed from the bytes, never taken from a name or a header) and its size cap. It is a leaf package so that both sides of an upload use the one rule: muster-server (internal/officers, internal/api) and the instance's own pod (internal/podagent, `ccd ask-image`).
Index ¶
Constants ¶
const MaxBytes = 5 << 20
MaxBytes is HQ's bound on one ask image: 5 MiB.
const SniffLen = 512
SniffLen is how many leading bytes Sniff needs (http.DetectContentType's).
Variables ¶
var Types = []string{"image/png", "image/jpeg", "image/webp"}
Types are the image types HQ accepts, as http.DetectContentType names them.
Functions ¶
Types ¶
type Record ¶
type Record struct {
ID string `json:"id"`
Filename string `json:"filename"`
ContentType string `json:"content_type"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}
Record is HQ's record of one uploaded ask image, as HQ answers POST /officers/{id}/ask-images and as muster's upload route passes it on.