X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=scheme.go;fp=scheme.go;h=b839282e77295ebd678da428d071f60a41502c16;hb=443182b338389120eb9039e27fe49f7b28cc5419;hp=0000000000000000000000000000000000000000;hpb=5f655d59e2fe169b925e2ba57cc1b24521a09b35;p=meta4ra.git diff --git a/scheme.go b/scheme.go new file mode 100644 index 0000000..b839282 --- /dev/null +++ b/scheme.go @@ -0,0 +1,64 @@ +/* +meta4a -- Metalink 4.0 creator +Copyright (C) 2021-2023 Sergey Matveev + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, version 3 of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +package meta4ra + +import ( + "encoding/xml" + "time" +) + +type Metalink struct { + XMLName xml.Name `xml:"urn:ietf:params:xml:ns:metalink metalink"` + Files []File `xml:"file"` + Generator string `xml:"generator,,omitempty"` + Published time.Time `xml:"published,,omitempty"` +} + +type File struct { + XMLName xml.Name `xml:"file"` + Name string `xml:"name,attr"` + Description string `xml:"description,,omitempty"` + Hashes []Hash `xml:"hash,,omitempty"` + MetaURLs []MetaURL `xml:"metaurl,,omitempty"` + Signature *Signature `xml:"signature"` + Size uint64 `xml:"size,,omitempty"` + URLs []URL `xml:"url,,omitempty"` +} + +type URL struct { + XMLName xml.Name `xml:"url"` + URL string `xml:",chardata"` +} + +type Signature struct { + XMLName xml.Name `xml:"signature"` + MediaType string `xml:"mediatype,attr"` + Signature string `xml:",cdata"` +} + +type Hash struct { + XMLName xml.Name `xml:"hash"` + Type string `xml:"type,attr"` + Hash string `xml:",chardata"` +} + +type MetaURL struct { + XMLName xml.Name `xml:"metaurl"` + MediaType string `xml:"mediatype,attr"` + URL string `xml:",chardata"` +}