diff --git a/bittorrent/params.go b/bittorrent/params.go index 19be5c3..1af1bfb 100644 --- a/bittorrent/params.go +++ b/bittorrent/params.go @@ -189,7 +189,7 @@ func (qp *QueryParams) String(key string) (string, bool) { // Uint64 returns a uint parsed from a query. After being called, it is safe to // cast the uint64 to your desired length. -func (qp *QueryParams) Uint64(key string, bitSize int) (uint64, error) { +func (qp *QueryParams) Uint(key string, bitSize int) (uint64, error) { str, exists := qp.params[key] if !exists { return 0, ErrKeyNotFound diff --git a/frontend/http/parser.go b/frontend/http/parser.go index aac161c..6061e44 100644 --- a/frontend/http/parser.go +++ b/frontend/http/parser.go @@ -74,25 +74,25 @@ func ParseAnnounce(r *http.Request, opts ParseOptions) (*bittorrent.AnnounceRequ request.Peer.ID = bittorrent.PeerIDFromString(peerID) // Determine the number of remaining bytes for the client. - request.Left, err = qp.Uint64("left", 64) + request.Left, err = qp.Uint("left", 64) if err != nil { return nil, bittorrent.ClientError("failed to parse parameter: left") } // Determine the number of bytes downloaded by the client. - request.Downloaded, err = qp.Uint64("downloaded", 64) + request.Downloaded, err = qp.Uint("downloaded", 64) if err != nil { return nil, bittorrent.ClientError("failed to parse parameter: downloaded") } // Determine the number of bytes shared by the client. - request.Uploaded, err = qp.Uint64("uploaded", 64) + request.Uploaded, err = qp.Uint("uploaded", 64) if err != nil { return nil, bittorrent.ClientError("failed to parse parameter: uploaded") } // Determine the number of peers the client wants in the response. - numwant, err := qp.Uint64("numwant", 32) + numwant, err := qp.Uint("numwant", 32) if err != nil && !errors.Is(err, bittorrent.ErrKeyNotFound) { return nil, bittorrent.ClientError("failed to parse parameter: numwant") } @@ -101,7 +101,7 @@ func ParseAnnounce(r *http.Request, opts ParseOptions) (*bittorrent.AnnounceRequ request.NumWant = uint32(numwant) // Parse the port where the client is listening. - port, err := qp.Uint64("port", 16) + port, err := qp.Uint("port", 16) if err != nil { return nil, bittorrent.ClientError("failed to parse parameter: port") }