narinfo

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NarInfo

type NarInfo struct {
	StorePath string // The full nix store path (/nix/store/…-pname-version)

	URL         string // The relative location to the .nar[.xz,…] file. Usually nar/$fileHash.nar[.xz]
	Compression string // The compression method file at URL is compressed with (none,xz,…)

	FileHash *nixhash.HashWithEncoding // The hash of the file at URL
	FileSize uint64                    // The size of the file at URL, in bytes

	// The hash of the .nar file, after possible decompression
	// Identical to FileHash if no compression is used.
	NarHash *nixhash.HashWithEncoding
	// The size of the .nar file, after possible decompression, in bytes.
	// Identical to FileSize if no compression is used.
	NarSize uint64

	// References to other store paths, contained in the .nar file
	References []string

	// Path of the .drv for this store path
	Deriver string

	// This doesn't seem to be used at all?
	System string

	// Signatures, if any.
	Signatures []*Signature

	// TODO: Figure out the meaning of this
	CA string
}

NarInfo represents a parsed .narinfo file.

func Parse

func Parse(r io.Reader) (*NarInfo, error)

Parse reads a .narinfo file content and returns a NarInfo struct with the parsed data.

func (*NarInfo) Check

func (n *NarInfo) Check() error

Check does some sanity checking on a NarInfo struct, such as:

  • ensuring the paths in StorePath, References and Deriver are syntactically valid (references and deriver first need to be made absolute)
  • when no compression is present, ensuring File{Hash,Size} and Nar{Hash,Size} are equal

func (NarInfo) ContentType

func (n NarInfo) ContentType() string

ContentType returns the mime content type of the object.

func (*NarInfo) String

func (n *NarInfo) String() string

type Signature

type Signature struct {
	KeyName string // An identifier for the key that's used for the signature

	Digest []byte // The digest itself, in bytes
}

Signature is used to sign a NarInfo (parts of it, to be precise).

func MustParseSignatureLine

func MustParseSignatureLine(signatureLine string) *Signature

MustParseSignatureLine parses a signature line and returns a Signature struct, or panics on error.

func ParseSignatureLine

func ParseSignatureLine(signatureLine string) (*Signature, error)

ParseSignatureLine parses a signature line and returns a Signature struct, or error.

func (*Signature) String

func (s *Signature) String() string

String returns the string representation of a signature, which is `KeyName:base`.

Jump to

Keyboard shortcuts

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