http: Unexport announce/scrape creation functions

This commit is contained in:
Justin Li 2015-02-20 01:36:49 -05:00
parent c2770ee741
commit d9a7611eee
3 changed files with 8 additions and 7 deletions

View file

@ -89,7 +89,7 @@ func (s *Server) serveAnnounce(w http.ResponseWriter, r *http.Request, p httprou
stats.RecordEvent(stats.Announce)
writer := &Writer{w}
ann, err := NewAnnounce(s.config, r, p)
ann, err := newAnnounce(s.config, r, p)
if err != nil {
return handleTorrentError(err, writer)
}
@ -101,7 +101,7 @@ func (s *Server) serveScrape(w http.ResponseWriter, r *http.Request, p httproute
stats.RecordEvent(stats.Scrape)
writer := &Writer{w}
scrape, err := NewScrape(s.config, r, p)
scrape, err := newScrape(s.config, r, p)
if err != nil {
return handleTorrentError(err, writer)
}

View file

@ -17,8 +17,8 @@ import (
"github.com/chihaya/chihaya/tracker/models"
)
// NewAnnounce parses an HTTP request and generates a models.Announce.
func NewAnnounce(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Announce, error) {
// newAnnounce parses an HTTP request and generates a models.Announce.
func newAnnounce(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Announce, error) {
q, err := query.New(r.URL.RawQuery)
if err != nil {
return nil, err
@ -80,8 +80,8 @@ func NewAnnounce(cfg *config.Config, r *http.Request, p httprouter.Params) (*mod
}, nil
}
// NewScrape parses an HTTP request and generates a models.Scrape.
func NewScrape(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Scrape, error) {
// newScrape parses an HTTP request and generates a models.Scrape.
func newScrape(cfg *config.Config, r *http.Request, p httprouter.Params) (*models.Scrape, error) {
q, err := query.New(r.URL.RawQuery)
if err != nil {
return nil, err

View file

@ -64,7 +64,8 @@ func (tkr *Tracker) LoadApprovedClients(clients []string) {
}
// Writer serializes a tracker's responses, and is implemented for each
// response transport used by the tracker.
// response transport used by the tracker. Only one of these may be called
// per request, and only once.
//
// Note, data passed into any of these functions will not contain sensitive
// information, so it may be passed back the client freely.