metalink

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 6 Imported by: 39

README

For creating and consuming Metalink files (XML-based download descriptions).

Notes

  • RFC 5854 - The Metalink Download Description Format
  • RFC 6249 - Metalink/HTTP: Mirrors and Hashes
  • aria2 - alternative client for downloading metalink files
  • [curl --metalink URL] - curl client may download metalink files

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalJSON added in v0.3.0

func MarshalJSON(r Metalink) ([]byte, error)

func MarshalXML added in v0.3.0

func MarshalXML(r Metalink) ([]byte, error)

func Sort added in v0.2.0

func Sort(r *Metalink)

func Unmarshal

func Unmarshal(data []byte, meta4 *Metalink) error

func UnmarshalJSON added in v0.3.0

func UnmarshalJSON(data []byte, meta4 *Metalink) error

func UnmarshalXML added in v0.3.0

func UnmarshalXML(data []byte, meta4 *Metalink) error

Types

type Extra_

type Extra_ struct {
	XMLName xml.Name `json:"-" yaml:"-"`
	Data    string   `xml:",innerxml"`
}

type File

type File struct {
	XMLName     xml.Name   `xml:"file" json:"-" yaml:"-"`
	Name        string     `xml:"name,attr" json:"name" yaml:"name"`
	Copyright   string     `xml:"copyright,,omitempty" json:"copyright,omitempty" yaml:"copyright,omitempty"`
	Description string     `xml:"description,,omitempty" json:"description,omitempty" yaml:"description,omitempty"`
	Hashes      []Hash     `xml:"hash,,omitempty" json:"hashes,omitempty" yaml:"hashes,omitempty"`
	Identity    string     `xml:"identity,,omitempty" json:"identity,omitempty" yaml:"identity,omitempty"`
	Language    []string   `xml:"language,,omitempty" json:"languages,omitempty" yaml:"language,omitempty"`
	MetaURLs    []MetaURL  `xml:"metaurl,,omitempty" json:"metaurls,omitempty" yaml:"metaurl,omitempty"`
	OS          []string   `xml:"os,,omitempty" json:"oses,omitempty" yaml:"os,omitempty"`
	Pieces      []Piece    `xml:"pieces,,omitempty" json:"pieces,omitempty" yaml:"piece,omitempty"`
	Publisher   *Publisher `xml:"publisher" json:"publisher,omitempty" yaml:"publisher,omitempty"`
	Signature   *Signature `xml:"signature" json:"signature,omitempty" yaml:"signature,omitempty"`
	Size        uint64     `xml:"size,,omitempty" json:"size,omitempty" yaml:"size,omitempty"`
	URLs        []URL      `xml:"url,,omitempty" json:"urls,omitempty" yaml:"url,omitempty"`
	Version     string     `xml:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
}

type Hash

type Hash struct {
	XMLName xml.Name `xml:"hash" json:"-" yaml:"-"`
	Type    HashType `xml:"type,attr" json:"type" yaml:"type"`
	Hash    string   `xml:",chardata" json:"hash" yaml:"hash"`
}

type HashType added in v0.3.0

type HashType string
const (
	HashTypeMD5    HashType = "md5"
	HashTypeSHA1   HashType = "sha-1"
	HashTypeSHA256 HashType = "sha-256"
	HashTypeSHA512 HashType = "sha-512"
)

type MetaURL

type MetaURL struct {
	XMLName   xml.Name `xml:"metaurl" json:"-" yaml:"-"`
	Priority  *uint    `xml:"priority,attr,omitempty" json:"priority,omitempty" yaml:"priority,omitempty"`
	MediaType string   `xml:"mediatype,attr" json:"mediatype" yaml:"mediatype"`
	Name      string   `xml:"name,attr,omitempty" json:"name,omitempty" yaml:"name,omitempty"`
	URL       string   `xml:",chardata" json:"url" yaml:"url"`
}
type Metalink struct {
	XMLName   xml.Name   `xml:"urn:ietf:params:xml:ns:metalink metalink" json:"-" yaml:"-"`
	Files     []File     `xml:"file" json:"files,omitempty" yaml:"files,omitempty"`
	Generator string     `xml:"generator,,omitempty" json:"generator,omitempty" yaml:"generator,omitempty"`
	Origin    *Origin    `xml:"origin,,omitempty" json:"origin,omitempty" yaml:"origin,omitempty"`
	Published *time.Time `xml:"published,,omitempty" json:"published,omitempty" yaml:"published,omitempty"`
	Updated   *time.Time `xml:"updated,,omitempty" json:"updated,omitempty" yaml:"updated,omitempty"`
}

type Origin

type Origin struct {
	XMLName xml.Name `xml:"origin" json:"-" yaml:"-"`
	Dynamic *bool    `xml:"dynamic,attr,omitempty" json:"dynamic,omitempty" yaml:"dynamic,omitempty"`
	URL     string   `xml:",chardata" json:"url" yaml:"url"`
}

type Piece

type Piece struct {
	XMLName xml.Name `xml:"pieces" json:"-" yaml:"-"`
	Type    string   `xml:"type,attr" json:"type" yaml:"type"`
	Length  string   `xml:"length,attr" json:"length" yaml:"length"`
	Hash    []string `xml:"hash,chardata" json:"hashes" yaml:"hash"`
}

type Publisher

type Publisher struct {
	XMLName xml.Name `xml:"publisher" json:"-" yaml:"-"`
	Name    string   `xml:"name,attr" json:"name" yaml:"name"`
	URL     string   `xml:"url,attr,omitempty" json:"url,omitempty" yaml:"url,omitempty"`
}

type Signature

type Signature struct {
	XMLName   xml.Name `xml:"signature" json:"-" yaml:"-"`
	MediaType string   `xml:"mediatype,attr" json:"mediatype" yaml:"mediatype"`
	Signature string   `xml:",cdata" json:"signature" yaml:"signature"`
}

type URL

type URL struct {
	XMLName  xml.Name `xml:"url" json:"-" yaml:"-"`
	Location string   `xml:"location,attr,omitempty" json:"location,omitempty" yaml:"location,omitempty"`
	Priority *uint    `xml:"priority,attr,omitempty" json:"priority,omitempty" yaml:"priority,omitempty"`
	URL      string   `xml:",chardata" json:"url" yaml:"url"`
}

Directories

Path Synopsis
cli
cmd
filefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
metaurl/metaurlfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
url
url/urlfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
cli
storagefakes
Code generated by counterfeiter.
Code generated by counterfeiter.
transferfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
verificationfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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