Documentation
¶
Overview ¶
Package stabilize provides stabilizers for normalizing archive contents.
Index ¶
- Variables
- func NewStabilizedGzipWriter(gr *gzip.Reader, w io.Writer, ctx *StabilizationContext) (*gzip.Writer, error)
- func Stabilize(dst io.Writer, src io.Reader, f archive.Format) error
- func StabilizeTar(tr *tar.Reader, tw *tar.Writer, ctx *StabilizationContext) error
- func StabilizeWithOpts(dst io.Writer, src io.Reader, f archive.Format, opts StabilizeOpts) error
- func StabilizeZip(zr *zip.Reader, zw *zip.Writer, ctx *StabilizationContext) error
- func WriteManifest(w io.Writer, m *Manifest) error
- type Always
- type Any
- type ArchiveLevel
- type ArchivePath
- type AtDepth
- type Constraint
- type Constraints
- type CustomStabilizerConfig
- type CustomStabilizerConfigOneOf
- type CustomStabilizerEntry
- type EntryInfo
- type ExcludePath
- type Format
- type Formats
- type GzipContentFn
- type GzipFn
- type Manifest
- type MinDepth
- type ReplacePattern
- type Section
- type StabilizationContext
- func (ctx *StabilizationContext) Depth() int
- func (ctx *StabilizationContext) Format() archive.Format
- func (ctx *StabilizationContext) WithEntry(path string) *StabilizationContext
- func (ctx *StabilizationContext) WithNestedArchive(format archive.Format, path string) *StabilizationContext
- func (ctx *StabilizationContext) WithStabilizers(stabilizers []Stabilizer) *StabilizationContext
- type StabilizeOpts
- type Stabilizer
- type StabilizerFn
- type TarArchiveFn
- type TarEntryContextFn
- type TarEntryFn
- type ZipArchiveFn
- type ZipEntryFn
Constants ¶
This section is empty.
Variables ¶
var AllCrateStabilizers = []Stabilizer{ StabilizeCargoVCSHash, }
AllCrateStabilizers is the list of all available crate stabilizers.
var AllGemStabilizers = []Stabilizer{ StableGemExcludeChecksums, StableGemMetadataDate, StableGemMetadataRubygemsVersion, StableGemInnerArchives, }
AllGemStabilizers is the list of all available gem stabilizers.
var AllGzipStabilizers = []Stabilizer{ StableGzipCompression, StableGzipName, StableGzipTime, StableGzipMisc, }
AllGzipStabilizers is the list of all available gzip stabilizers.
var AllJarStabilizers = []Stabilizer{ StableJARBuildMetadata, StableJAROrderOfAttributeValues, StableGitProperties, }
AllJarStabilizers is the list of all available JAR stabilizers.
var AllStabilizers = slices.Concat(AllZipStabilizers, AllTarStabilizers, AllGzipStabilizers, AllJarStabilizers, AllCrateStabilizers, AllGemStabilizers)
AllStabilizers is the complete list of all available stabilizers across all formats.
var AllTarStabilizers = []Stabilizer{ StableTarFileOrder, StableTarTime, StableTarFileMode, StableTarOwners, StableTarXattrs, StableTarDeviceNumber, }
AllTarStabilizers is the list of all available tar stabilizers.
var AllZipStabilizers = []Stabilizer{ StableZipFileOrder, StableZipModifiedTime, StableZipCompression, StableZipDataDescriptor, StableZipFileEncoding, StableZipFileMode, StableZipMisc, }
AllZipStabilizers is the list of all available zip stabilizers.
var StabilizeCargoVCSHash = Stabilizer{ Name: "cargo-vcs-hash", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { if strings.HasSuffix(e.Name, ".cargo_vcs_info.json") { var vcsInfo map[string]any if err := json.Unmarshal(e.Body, &vcsInfo); err != nil { return } if git, ok := vcsInfo["git"].(map[string]any); ok { if _, hasSha1 := git["sha1"]; hasSha1 { git["sha1"] = strings.Repeat("x", hash.HexSize) if newBody, err := json.Marshal(vcsInfo); err == nil { e.Body = newBody e.Size = int64(len(newBody)) } } } } }))
StabilizeCargoVCSHash normalizes the VCS hash in cargo_vcs_info.json files.
var StableGemExcludeChecksums = Stabilizer{ Name: "gem-exclude-checksums", }.WithConstraints(AtDepth(0)).WithFn(TarArchiveFn(func(ta *archive.TarArchive) { ta.Files = slices.DeleteFunc(ta.Files, func(e *archive.TarEntry) bool { return e.Name == "checksums.yaml.gz" }) }))
StableGemExcludeChecksums removes checksums.yaml.gz since its content references pre-stabilization archive hashes. Constrained to depth 0 (the outermost .gem tar).
var StableGemInnerArchives = Stabilizer{ Name: "gem-inner-archives", }.WithConstraints(AtDepth(0)).WithFn(TarEntryContextFn(func(entry *archive.TarEntry, ctx *StabilizationContext) { var innerFormat archive.Format switch entry.Name { case "data.tar.gz": innerFormat = archive.TarGzFormat case "metadata.gz": innerFormat = archive.GzipFormat default: return } nestedCtx := ctx.WithNestedArchive(innerFormat, entry.Name) var buf bytes.Buffer if err := stabilizeWithCtx(&buf, bytes.NewReader(entry.Body), innerFormat, nestedCtx); err != nil { return } entry.Body = buf.Bytes() entry.Size = int64(len(entry.Body)) }))
StableGemInnerArchives recursively stabilizes the inner archives within a gem. Constrained to depth 0 (the outermost .gem tar) to avoid applying to nested archives.
var StableGemMetadataDate = Stabilizer{ Name: "gem-metadata-date", }.WithConstraints(AtDepth(1), ArchivePath("metadata.gz")).WithFn(GzipContentFn(func(b []byte) []byte { return gemMetadataDateRe.ReplaceAll(b, []byte("date: 1980-01-02 00:00:00.000000000 Z")) }))
StableGemMetadataDate normalizes the date field in gem metadata YAML. The date is stamped by `gem build` at build time and so varies across rebuilds. The replacement value matches RubyGems' DEFAULT_SOURCE_DATE_EPOCH (1980-01-02 UTC): https://github.com/rubygems/rubygems/blob/0b469ed/lib/rubygems.rb#L151
var StableGemMetadataRubygemsVersion = Stabilizer{ Name: "gem-metadata-rubygems-version", }.WithConstraints(AtDepth(1), ArchivePath("metadata.gz")).WithFn(GzipContentFn(func(b []byte) []byte { return gemMetadataRubygemsVersionRe.ReplaceAll(b, []byte("rubygems_version: 0.0.0")) }))
StableGemMetadataRubygemsVersion normalizes the rubygems_version field in gem metadata YAML. This field records the RubyGems version used to build the gem and may differ between the original and rebuild environments.
var StableGitProperties = Stabilizer{ Name: "jar-git-properties", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { if path.Base(zf.Name) == "git.json" { zf.SetContent([]byte("{}")) } if path.Base(zf.Name) == "git.properties" { zf.SetContent([]byte{}) } }))
StableGitProperties clears git.json and git.properties files.
var StableGzipCompression = Stabilizer{ Name: "gzip-compression", }.WithFn(GzipFn(func(h *archive.MutableGzipHeader) { h.Compression = gzip.NoCompression }))
StableGzipCompression sets compression to no compression.
var StableGzipMisc = Stabilizer{ Name: "gzip-misc", }.WithFn(GzipFn(func(h *archive.MutableGzipHeader) { h.Comment = "" h.Extra = nil h.OS = 255 }))
StableGzipMisc clears miscellaneous metadata fields.
var StableGzipName = Stabilizer{ Name: "gzip-name", }.WithFn(GzipFn(func(h *archive.MutableGzipHeader) { h.Name = "" }))
StableGzipName clears the filename.
var StableGzipTime = Stabilizer{ Name: "gzip-time", }.WithFn(GzipFn(func(h *archive.MutableGzipHeader) { h.ModTime = time.Time{} }))
StableGzipTime zeroes out modification time.
var StableJARBuildMetadata = Stabilizer{ Name: "jar-build-metadata", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { if !strings.HasSuffix(zf.Name, "META-INF/MANIFEST.MF") { return } r, err := zf.Open() if err != nil { return } manifest, err := ParseManifest(r) if err != nil { return } for _, attr := range []string{ "Archiver-Version", "Bnd-LastModified", "Build-Date", "Build-Date-UTC", "Build-Host", "Build-Id", "Build-Java-Version", "Build-Jdk", "Build-Jdk-Spec", "Build-Job", "Build-Number", "Build-OS", "Build-Status", "Build-Time", "Build-Timestamp", "Build-Tool", "Build-Url", "Built-By", "Built-Date", "Built-Host", "Built-JDK", "Built-On", "Built-OS", "Built-Status", "Created-By", "DSTAMP", "Eclipse-SourceReferences", "Git-Branch", "Git-Commit-Id-Describe", "Git-Remote-Origin-Url", "Git-SHA", "Git-Descriptor", "git-describe", "git-tags", "hash", "Hudson-Build-Number", "Implementation-Build-Date", "Implementation-Build-Java-Vendor", "Implementation-Build-Java-Version", "Implementation-Build", "Ion-Java-Build-Time", "Java-Vendor", "Java-Version", "JCabi-Date", "Jenkins-Build-Number", "Maven-Version", "Module-Origin", "Originally-Created-By", "Os-Arch", "Os-Name", "Os-Version", "SCM-Git-Branch", "SCM-Git-Commit-Dirty", "SCM-Git-Commit-ID", "SCM-Git-Commit-Abbrev", "SCM-Git-Commit-Description", "SCM-Git-Commit-Timestamp", "SCM-Revision", "SHA-256-Digest", "Source-Date-Epoch", "Sunset-BuiltOn", "TODAY", "Tool", "TSTAMP", "url", } { manifest.MainSection.Delete(attr) } buf := bytes.NewBuffer(nil) if err := WriteManifest(buf, manifest); err != nil { return } zf.SetContent(buf.Bytes()) }))
StableJARBuildMetadata removes build-related metadata from MANIFEST.MF files.
var StableJAROrderOfAttributeValues = Stabilizer{ Name: "jar-attribute-value-order", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { if !strings.HasSuffix(zf.Name, "META-INF/MANIFEST.MF") { return } r, err := zf.Open() if err != nil { return } manifest, err := ParseManifest(r) if err != nil { return } for _, attr := range []string{ "Export-Package", "Include-Resource", "Provide-Capability", "Private-Package", } { value, _ := manifest.MainSection.Get(attr) if value == "" { continue } subvalues := splitPreservingQuotes(value, ',') sort.Strings(subvalues) for i, subvalue := range subvalues { subvalueArray := splitPreservingQuotes(subvalue, ';') sort.Strings(subvalueArray) subvalues[i] = strings.Join(subvalueArray, ";") } manifest.MainSection.Set(attr, strings.Join(subvalues, ",")) } buf := bytes.NewBuffer(nil) if err := WriteManifest(buf, manifest); err != nil { return } zf.SetContent(buf.Bytes()) }))
StableJAROrderOfAttributeValues sorts attribute values in MANIFEST.MF files.
var StableTarDeviceNumber = Stabilizer{ Name: "tar-device-number", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { e.Devmajor = 0 e.Devminor = 0 }))
StableTarDeviceNumber clears device numbers.
var StableTarFileMode = Stabilizer{ Name: "tar-file-mode", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { e.Mode = int64(fs.ModePerm) }))
StableTarFileMode sets file mode to default permissions.
var StableTarFileOrder = Stabilizer{ Name: "tar-file-order", }.WithFn(TarArchiveFn(func(f *archive.TarArchive) { slices.SortFunc(f.Files, func(a, b *archive.TarEntry) int { return strings.Compare(a.Name, b.Name) }) }))
StableTarFileOrder sorts tar entries by name.
var StableTarOwners = Stabilizer{ Name: "tar-owners", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { e.Uid = 0 e.Gid = 0 e.Uname = "" e.Gname = "" }))
StableTarOwners clears owner information.
var StableTarTime = Stabilizer{ Name: "tar-time", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { e.ModTime = time.UnixMilli(0) e.AccessTime = time.UnixMilli(0) e.ChangeTime = time.Time{} e.Format = tar.FormatPAX }))
StableTarTime zeroes out timestamps.
var StableTarXattrs = Stabilizer{ Name: "tar-xattrs", }.WithFn(TarEntryFn(func(e *archive.TarEntry) { clear(e.Xattrs) clear(e.PAXRecords) }))
StableTarXattrs clears extended attributes and PAX records.
var StableZipCompression = Stabilizer{ Name: "zip-compression", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.Method = zip.Store }))
StableZipCompression sets compression to Store (uncompressed).
var StableZipDataDescriptor = Stabilizer{ Name: "zip-data-descriptor", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.Flags = zf.Flags & ^dataDescriptorFlag zf.CRC32 = 0 zf.CompressedSize = 0 zf.CompressedSize64 = 0 zf.UncompressedSize = 0 zf.UncompressedSize64 = 0 }))
StableZipDataDescriptor clears data descriptor flags and related fields.
var StableZipFileEncoding = Stabilizer{ Name: "zip-file-encoding", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.NonUTF8 = false }))
StableZipFileEncoding clears the non-UTF8 flag.
var StableZipFileMode = Stabilizer{ Name: "zip-file-mode", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.CreatorVersion = 0 zf.ExternalAttrs = 0 }))
StableZipFileMode clears creator version and external attributes.
var StableZipFileOrder = Stabilizer{ Name: "zip-file-order", }.WithFn(ZipArchiveFn(func(zr *archive.MutableZipReader) { slices.SortFunc(zr.File, func(i, j *archive.MutableZipFile) int { return strings.Compare(i.Name, j.Name) }) }))
StableZipFileOrder sorts zip entries by name.
var StableZipMisc = Stabilizer{ Name: "zip-misc", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.Comment = "" zf.ReaderVersion = 0 zf.Extra = []byte{} zf.Flags = zf.Flags & dataDescriptorFlag }))
StableZipMisc clears miscellaneous metadata fields.
var StableZipModifiedTime = Stabilizer{ Name: "zip-modified-time", }.WithFn(ZipEntryFn(func(zf *archive.MutableZipFile) { zf.Modified = time.UnixMilli(0) zf.ModifiedDate = 0 zf.ModifiedTime = 0 }))
StableZipModifiedTime zeroes out timestamps.
Functions ¶
func NewStabilizedGzipWriter ¶
func NewStabilizedGzipWriter(gr *gzip.Reader, w io.Writer, ctx *StabilizationContext) (*gzip.Writer, error)
NewStabilizedGzipWriter applies the provided stabilizers to the gzip.Reader metadata. The caller is responsible for closing the returned writer.
NOTE: This abstraction differs from the other stabilizers because the compression level used in the gzip.Writer is not configurable after construction. As a result, a raw writer must be provided and a gzip.Writer returned to ensure a configurable compression level.
func StabilizeTar ¶
StabilizeTar strips volatile metadata and re-writes the provided archive in a standard form.
func StabilizeWithOpts ¶
StabilizeWithOpts selects and applies the provided stabilization routine for the given archive format.
func StabilizeZip ¶
StabilizeZip strips volatile metadata and rewrites the provided archive in a standard form.
Types ¶
type Always ¶
type Always struct{}
Always matches unconditionally.
func (Always) Matches ¶
func (Always) Matches(*StabilizationContext) bool
Matches always returns true.
type Any ¶
type Any Constraints
func (Any) Matches ¶
func (a Any) Matches(ctx *StabilizationContext) bool
type ArchiveLevel ¶
type ArchiveLevel struct {
// Format is the type of archive at this nesting level.
Format archive.Format
// Path is the path of this archive relative to the parent nesting level.
Path string
}
ArchiveLevel represents a single level in a nested archive.
type ArchivePath ¶
type ArchivePath string
ArchivePath matches when the current archive level's path equals the given value.
func (ArchivePath) Matches ¶
func (c ArchivePath) Matches(ctx *StabilizationContext) bool
Matches returns true if the innermost archive level's path matches.
type AtDepth ¶
type AtDepth int
AtDepth matches when the nesting depth equals n.
func (AtDepth) Matches ¶
func (c AtDepth) Matches(ctx *StabilizationContext) bool
Matches returns true if the current depth equals n.
type Constraint ¶
type Constraint interface {
Matches(ctx *StabilizationContext) bool
}
Constraint determines if a stabilizer applies in a given context.
type Constraints ¶
type Constraints []Constraint
func (Constraints) Matches ¶
func (cs Constraints) Matches(ctx *StabilizationContext) bool
type CustomStabilizerConfig ¶
type CustomStabilizerConfig interface {
Stabilizer(name string) Stabilizer
Validate() error
}
CustomStabilizerConfig defines a custom stabilizer that can be materialized for many formats
type CustomStabilizerConfigOneOf ¶
type CustomStabilizerConfigOneOf struct {
ReplacePattern *ReplacePattern `yaml:"replace_pattern"`
ExcludePath *ExcludePath `yaml:"exclude_path"`
}
CustomStabilizerConfigOneOf aggregates known implementations of CustomStabilizerConfig
func (*CustomStabilizerConfigOneOf) CustomStabilizerConfig ¶
func (cfg *CustomStabilizerConfigOneOf) CustomStabilizerConfig() CustomStabilizerConfig
CustomStabilizerConfig returns the configured custom stabilizer.
func (*CustomStabilizerConfigOneOf) Validate ¶
func (cfg *CustomStabilizerConfigOneOf) Validate() error
Validate ensures exactly one config is set.
type CustomStabilizerEntry ¶
type CustomStabilizerEntry struct {
Config CustomStabilizerConfigOneOf `yaml:",inline"`
Reason string `yaml:"reason"`
}
CustomStabilizerEntry defines a custom Stabilizer
func (CustomStabilizerEntry) Validate ¶
func (ent CustomStabilizerEntry) Validate() error
Validate ensures the entry is valid.
type EntryInfo ¶
type EntryInfo struct {
// Path is the name of this entry within its enclosing archive.
Path string
}
EntryInfo provides information about the current entry being stabilized.
type ExcludePath ¶
type ExcludePath struct {
Paths []string `yaml:"paths"`
}
ExcludePath is stabilizer that removes specified path(s) from the output - Paths is a slice of path.Match-like patterns defining the archive paths to apply the exclusion. NOTE: This does not support archive nesting. All paths are relative to the outermost archive.
func (*ExcludePath) Stabilizer ¶
func (ep *ExcludePath) Stabilizer(name string) Stabilizer
Stabilizer materializes a Stabilizer for the given config, name, and format.
func (*ExcludePath) Validate ¶
func (ep *ExcludePath) Validate() error
Validate ensures the exclude path is valid.
type Format ¶
Format matches when current archive format equals f.
func (Format) Matches ¶
func (c Format) Matches(ctx *StabilizationContext) bool
Matches returns true if the current archive format matches.
type Formats ¶
Formats matches any of the given formats.
func (Formats) Matches ¶
func (c Formats) Matches(ctx *StabilizationContext) bool
Matches returns true if the current archive format is one of the given formats.
type GzipContentFn ¶
GzipContentFn applies stabilization to the decompressed content of a standalone gzip archive. It is only applied for GzipFormat (not TarGzFormat, where the inner content is a tar archive handled by tar stabilizers).
func (GzipContentFn) Constraints ¶
func (GzipContentFn) Constraints() Constraints
type GzipFn ¶
type GzipFn func(*archive.MutableGzipHeader)
GzipFn applies stabilization to gzip metadata.
func (GzipFn) Constraints ¶
func (GzipFn) Constraints() Constraints
type Manifest ¶
type Manifest struct {
MainSection *Section
EntrySections []*Section
OriginalContent []byte // Keep original content for modification
}
Manifest represents a parsed MANIFEST.MF file
type MinDepth ¶
type MinDepth int
MinDepth matches when the nesting depth is at least n.
func (MinDepth) Matches ¶
func (c MinDepth) Matches(ctx *StabilizationContext) bool
Matches returns true if the current depth is at least n.
type ReplacePattern ¶
type ReplacePattern struct {
Paths []string `yaml:"paths"`
Pattern string `yaml:"pattern"`
Replace string `yaml:"replace"`
}
ReplacePattern is a regex replace stabilizer applied to a specified path - Paths is a slice of path.Match-like patterns defining the archive paths to apply the exclusion. - Pattern is a regex that accepts the golang RE2 syntax. - Replace can define a substitution for the matched content. NOTE: This does not support archive nesting. All paths are relative to the outermost archive.
func (*ReplacePattern) Stabilizer ¶
func (rp *ReplacePattern) Stabilizer(name string) Stabilizer
Stabilizer materializes a Stabilizer for the given config, name, and format.
func (*ReplacePattern) Validate ¶
func (rp *ReplacePattern) Validate() error
Validate ensures the replace pattern is valid.
type Section ¶
type Section struct {
// Names of Attributes, by default maintaining their original order of appearance
Names []string
// contains filtered or unexported fields
}
Section represents a section in the manifest file
type StabilizationContext ¶
type StabilizationContext struct {
Levels []ArchiveLevel
Entry *EntryInfo
Stabilizers []Stabilizer
}
StabilizationContext tracks position within potentially nested archives and carries the stabilizer pipeline for recursive application.
func NewContext ¶
func NewContext(format archive.Format) *StabilizationContext
NewContext creates a context for the outermost archive.
func (*StabilizationContext) Depth ¶
func (ctx *StabilizationContext) Depth() int
Depth returns the current nesting depth (0 for the outermost archive).
func (*StabilizationContext) Format ¶
func (ctx *StabilizationContext) Format() archive.Format
Format returns the format of the current archive layer.
func (*StabilizationContext) WithEntry ¶
func (ctx *StabilizationContext) WithEntry(path string) *StabilizationContext
WithEntry returns a new context with the given entry information.
func (*StabilizationContext) WithNestedArchive ¶
func (ctx *StabilizationContext) WithNestedArchive(format archive.Format, path string) *StabilizationContext
WithNestedArchive returns a new context with an additional nesting level.
func (*StabilizationContext) WithStabilizers ¶
func (ctx *StabilizationContext) WithStabilizers(stabilizers []Stabilizer) *StabilizationContext
WithStabilizers returns a new context with the given stabilizers.
type StabilizeOpts ¶
type StabilizeOpts struct {
Stabilizers []Stabilizer
}
StabilizeOpts aggregates stabilizers to be used in stabilization.
type Stabilizer ¶
type Stabilizer struct {
Name string
// contains filtered or unexported fields
}
Stabilizer defines a stabilization operation with applicability constraints.
func CreateCustomStabilizers ¶
func CreateCustomStabilizers(entries []CustomStabilizerEntry, format archive.Format) ([]Stabilizer, error)
CreateCustomStabilizers converts a set of CustomStabilizerEntry specs to Stabilizers. NOTE: This should only be called once. It generates stabilizer names using a 0-based integer counter so subsequent calls will generate identical names.
func (Stabilizer) FnFor ¶
func (s Stabilizer) FnFor(ctx *StabilizationContext) StabilizerFn
FnFor returns the concrete implementation for the given context.
func (Stabilizer) WithConstraints ¶
func (s Stabilizer) WithConstraints(c ...Constraint) Stabilizer
WithConstraints returns a Stabilizer with the added constraints.
func (Stabilizer) WithFn ¶
func (s Stabilizer) WithFn(fn StabilizerFn) Stabilizer
WithFn returns a Stabilizer with a single implementation.
func (Stabilizer) WithFns ¶
func (s Stabilizer) WithFns(fns map[archive.Format]StabilizerFn) Stabilizer
WithFns returns a Stabilizer with multiple implementations for different formats.
type StabilizerFn ¶
type StabilizerFn interface {
Constraints() Constraints
}
StabilizerFn is the marker interface for stabilizer functions.
type TarArchiveFn ¶
type TarArchiveFn func(*archive.TarArchive)
TarArchiveFn applies stabilization to an entire tar archive.
func (TarArchiveFn) Constraints ¶
func (TarArchiveFn) Constraints() Constraints
type TarEntryContextFn ¶
type TarEntryContextFn func(entry *archive.TarEntry, ctx *StabilizationContext)
TarEntryContextFn is a context-aware variant of TarEntryFn. It receives the stabilization context, enabling stabilization of nested archives.
func (TarEntryContextFn) Constraints ¶
func (TarEntryContextFn) Constraints() Constraints
type TarEntryFn ¶
TarEntryFn applies stabilization to a single tar entry.
func (TarEntryFn) Constraints ¶
func (TarEntryFn) Constraints() Constraints
type ZipArchiveFn ¶
type ZipArchiveFn func(*archive.MutableZipReader)
ZipArchiveFn applies stabilization to an entire zip archive.
func (ZipArchiveFn) Constraints ¶
func (ZipArchiveFn) Constraints() Constraints
type ZipEntryFn ¶
type ZipEntryFn func(*archive.MutableZipFile)
ZipEntryFn applies stabilization to a single zip entry.
func (ZipEntryFn) Constraints ¶
func (ZipEntryFn) Constraints() Constraints