aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta/torrent.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/meta/torrent.go b/meta/torrent.go
index d30dc48..9b1b124 100644
--- a/meta/torrent.go
+++ b/meta/torrent.go
@@ -3,6 +3,7 @@ package meta
import (
"errors"
"fmt"
+ "os"
"path"
"time"
)
@@ -36,6 +37,15 @@ func (i Info) FullPath(n int) (string, error) {
return path.Join(p...), nil
}
+// piece-to-file mapping:
+// piece # -> [ { file #, off, len }, ... ]
+
+type pieceToFile map[int][]struct {
+ fd os.File
+ offset int
+ length int
+}
+
func (i Info) FindFile(chunk, offset int) int {
if i.isSingleFile() {
return 0