askimage

package
v0.177.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const MaxBytes = 5 << 20

MaxBytes is HQ's bound on one ask image: 5 MiB.

View Source
const SniffLen = 512

SniffLen is how many leading bytes Sniff needs (http.DetectContentType's).

Variables

View Source
var Types = []string{"image/png", "image/jpeg", "image/webp"}

Types are the image types HQ accepts, as http.DetectContentType names them.

Functions

func Sniff

func Sniff(head []byte) (string, bool)

Sniff is the content type of data's leading bytes and whether it is one of Types.

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.

Jump to

Keyboard shortcuts

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