"strings"
"github.com/RoaringBitmap/roaring"
+
"github.com/anacrolix/torrent/common"
"github.com/anacrolix/torrent/metainfo"
"github.com/anacrolix/torrent/segments"
r.cancel()
}
-type Spec struct {
- Urls []string
- EncodeUrl func(string) string
-}
-
type Client struct {
HttpClient *http.Client
Url string
// private in the future, if Client ever starts removing pieces.
Pieces roaring.Bitmap
ResponseBodyWrapper ResponseBodyWrapper
- EncodeUrl func(string) string
+ PathEscaper PathEscaper
}
type ResponseBodyWrapper func(io.Reader) io.Reader
ctx, cancel := context.WithCancel(context.Background())
var requestParts []requestPart
if !ws.fileIndex.Locate(r, func(i int, e segments.Extent) bool {
- req, err := NewRequestWithCustomUrlEncoding(
+ req, err := newRequest(
ws.Url, i, ws.info, e.Start, e.Length,
- ws.EncodeUrl,
+ ws.PathEscaper,
)
if err != nil {
panic(err)