mirror of
https://github.com/sot-tech/mochi.git
synced 2026-07-15 21:08:10 -07:00
update docs all around
This commit is contained in:
@@ -12,10 +12,12 @@ import (
|
||||
"github.com/chihaya/chihaya/tracker/models"
|
||||
)
|
||||
|
||||
// Writer implements the tracker.Writer interface for the HTTP protocol.
|
||||
type Writer struct {
|
||||
http.ResponseWriter
|
||||
}
|
||||
|
||||
// WriteError writes a bencode dict with a failure reason.
|
||||
func (w *Writer) WriteError(err error) error {
|
||||
bencoder := bencode.NewEncoder(w)
|
||||
|
||||
@@ -24,6 +26,7 @@ func (w *Writer) WriteError(err error) error {
|
||||
})
|
||||
}
|
||||
|
||||
// WriteAnnounce writes a bencode dict representation of an AnnounceResponse.
|
||||
func (w *Writer) WriteAnnounce(res *models.AnnounceResponse) error {
|
||||
dict := bencode.Dict{
|
||||
"complete": res.Complete,
|
||||
@@ -45,6 +48,7 @@ func (w *Writer) WriteAnnounce(res *models.AnnounceResponse) error {
|
||||
return bencoder.Encode(dict)
|
||||
}
|
||||
|
||||
// WriteScrape writes a bencode dict representation of a ScrapeResponse.
|
||||
func (w *Writer) WriteScrape(res *models.ScrapeResponse) error {
|
||||
dict := bencode.Dict{
|
||||
"files": filesDict(res.Files),
|
||||
|
||||
Reference in New Issue
Block a user