Documentation
¶
Overview ¶
Package bundlefooter implements the AFBNDL01 trailer described in ADR 0004 (and task-sdk/docs/executable-bundle-spec.rst). A bundle file is the compiled executable with three appended regions: the source bytes, the manifest bytes, and a fixed 64-byte trailer that locates them and carries a SHA-256 over the binary region for integrity.
The trailer layout (all little-endian) is:
bytes 0..3 source_len uint32 bytes 4..7 metadata_len uint32 bytes 8..11 footer_ver uint32 (= 1) bytes 12..43 binary_sha256 32 bytes (SHA-256 of the binary region) bytes 44..55 reserved 12 bytes, zero bytes 56..63 magic 8 bytes ASCII "AFBNDL01"
Index ¶
Constants ¶
const ( // TrailerSize is the fixed length of the trailer, in bytes. TrailerSize = 64 FooterVersion = 1 // MaxRegionSize is the largest source or metadata region this footer // format can address (uint32 length field). MaxRegionSize = math.MaxUint32 )
Variables ¶
var ErrHashMismatch = errors.New("bundlefooter: binary_sha256 mismatch")
ErrHashMismatch is returned by Read when the SHA-256 recomputed over the binary region does not match the binary_sha256 recorded in the trailer.
var ErrNotBundle = errors.New("bundlefooter: not a bundle (magic mismatch)")
ErrNotBundle is returned by Read when the file does not end with the AFBNDL01 magic.
var ErrUnknownVersion = errors.New("bundlefooter: unknown footer version")
ErrUnknownVersion is returned by Read when the trailer's footer_ver field is something other than FooterVersion.
var Magic = [8]byte{'A', 'F', 'B', 'N', 'D', 'L', '0', '1'}
Magic is the 8-byte ASCII tag that identifies a file as a bundle.
Functions ¶
func Append ¶
Append writes the source bytes, metadata bytes, and trailer to the end of the file at execPath. The file's existing contents (the executable) are left intact and its mode bits are preserved. source MAY be nil/empty.