frontend: add defaults for parser options

This commit is contained in:
Leo Balduf
2019-10-12 12:52:16 +09:00
parent eed141dbe4
commit cb88a11d6a
4 changed files with 92 additions and 12 deletions
+7
View File
@@ -20,6 +20,13 @@ type ParseOptions struct {
MaxScrapeInfoHashes uint32 `yaml:"max_scrape_infohashes"`
}
// Default parser config constants.
const (
defaultMaxNumWant uint32 = 100
defaultDefaultNumWant uint32 = 50
defaultMaxScrapeInfoHashes uint32 = 50
)
// ParseAnnounce parses an bittorrent.AnnounceRequest from an http.Request.
func ParseAnnounce(r *http.Request, opts ParseOptions) (*bittorrent.AnnounceRequest, error) {
qp, err := bittorrent.ParseURLData(r.RequestURI)