aboutsummaryrefslogtreecommitdiff
path: root/meta/info.go
diff options
context:
space:
mode:
Diffstat (limited to 'meta/info.go')
-rw-r--r--meta/info.go11
1 files changed, 1 insertions, 10 deletions
diff --git a/meta/info.go b/meta/info.go
index 51378ed..778c394 100644
--- a/meta/info.go
+++ b/meta/info.go
@@ -19,22 +19,13 @@ type Info struct {
Pieces Pieces `bencode:"pieces"`
Private bool `bencode:"private"` // BEP-0027
RootHash []byte `bencode:"root hash"` // BEP-0030
- Raw []byte `bencode:"-"`
+ Raw []byte `bencode:"-"` // raw representation of bencoded structure
}
func (i Info) Hash() [sha1.Size]byte {
return sha1.Sum(i.Raw)
}
-// NPieces returns number of all pieces
-func (i Info) NPieces() int {
- full, last := i.Full(), i.Last()
- if last > 0 {
- return full + 1
- }
- return full
-}
-
// Full returns count of full pieces
func (i Info) Full() int {
return int(i.TotalLength() / int64(i.PieceLength))