// Highly-customizable HTTP, HTTP/2, HTTPS server
package godlighty
-const Version = "godlighty/0.10.0"
+const Version = "godlighty/0.11.0"
var BindAddr string
`>; rel=describedby; type="application/metalink4+xml"`,
)
for _, u := range forHTTP.URLs {
- w.Header().Add("Link", "<"+u+">; rel=duplicate")
+ s := "<" + u.URL + ">; rel=duplicate"
+ if u.Priority != 0 {
+ s += "; pri=" + strconv.Itoa(int(u.Priority))
+ }
+ if u.Location != "" {
+ s += "; geo=" + u.Location
+ }
+ w.Header().Add("Link", s)
}
for name, digest := range forHTTP.Hashes {
w.Header().Add("Digest", name+"="+base64.StdEncoding.EncodeToString(digest))
type ForHTTP struct {
Hashes map[string][]byte
- URLs []string
+ URLs []URL
Torrents []string
}
}
forHTTP.Hashes[name] = digest
}
- for _, u := range f.URLs {
- forHTTP.URLs = append(forHTTP.URLs, u.URL)
- }
+ forHTTP.URLs = f.URLs
for _, m := range f.MetaURLs {
if m.MediaType == "torrent" {
forHTTP.Torrents = append(forHTTP.Torrents, m.URL)
}
type URL struct {
- XMLName xml.Name `xml:"url"`
- URL string `xml:",chardata"`
+ XMLName xml.Name `xml:"url"`
+ Location string `xml:"location,attr"`
+ Priority uint `xml:"priority,attr"`
+ URL string `xml:",chardata"`
}
type Signature struct {