par2gen

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package par2gen builds minimal valid PAR2 index files in memory for use in tests that exercise PAR2-based filename deobfuscation.

Only FileDesc packets are emitted — enough for the par2.GetFileDescriptors path that reconstructs real filenames from obfuscated Usenet releases. No recovery blocks, IFSC, or Main packets are generated; the par2 reader used by altmount ignores those packet types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(entries ...FileEntry) []byte

Build returns the binary content of a minimal PAR2 index containing one FileDesc packet per entry. The result can be served directly from fakepool as the payload for a PAR2 index segment.

Types

type FileEntry

type FileEntry struct {
	// Name is the real (unobfuscated) filename.
	Name string
	// Content is the file payload. The first 16 KB (zero-padded to exactly
	// 16384 bytes) determines Hash16k, which is how the importer matches
	// obfuscated files to their real names.
	Content []byte
}

FileEntry describes one file that should appear in the generated PAR2 index.

Jump to

Keyboard shortcuts

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