diff --git a/analysis/peer-upload-order.go b/analysis/peer-upload-order.go index cef18ce4..87138040 100644 --- a/analysis/peer-upload-order.go +++ b/analysis/peer-upload-order.go @@ -5,9 +5,10 @@ import ( "log" "sync" + "github.com/elliotchance/orderedmap" + "github.com/anacrolix/torrent" pp "github.com/anacrolix/torrent/peer_protocol" - "github.com/elliotchance/orderedmap" ) type peerData struct { diff --git a/client.go b/client.go index d0151fda..3d0397aa 100644 --- a/client.go +++ b/client.go @@ -19,12 +19,6 @@ import ( "strings" "time" - "github.com/davecgh/go-spew/spew" - "github.com/dustin/go-humanize" - gbtree "github.com/google/btree" - "github.com/pion/datachannel" - "golang.org/x/time/rate" - "github.com/anacrolix/chansync" "github.com/anacrolix/chansync/events" "github.com/anacrolix/dht/v2" @@ -37,6 +31,11 @@ import ( "github.com/anacrolix/missinggo/v2/bitmap" "github.com/anacrolix/missinggo/v2/pproffd" "github.com/anacrolix/sync" + "github.com/davecgh/go-spew/spew" + "github.com/dustin/go-humanize" + gbtree "github.com/google/btree" + "github.com/pion/datachannel" + "golang.org/x/time/rate" "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/internal/limiter" diff --git a/cmd/torrent/create.go b/cmd/torrent/create.go index 8f4440c4..5169a1f5 100644 --- a/cmd/torrent/create.go +++ b/cmd/torrent/create.go @@ -1,11 +1,13 @@ package main import ( + "os" + "github.com/anacrolix/bargle" "github.com/anacrolix/tagflag" + "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" - "os" ) var builtinAnnounceList = [][]string{ diff --git a/cmd/torrent/download.go b/cmd/torrent/download.go index cd487edb..1f2fbc89 100644 --- a/cmd/torrent/download.go +++ b/cmd/torrent/download.go @@ -16,14 +16,15 @@ import ( "github.com/anacrolix/log" "github.com/anacrolix/tagflag" + "github.com/davecgh/go-spew/spew" + "github.com/dustin/go-humanize" + "golang.org/x/time/rate" + "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/iplist" "github.com/anacrolix/torrent/metainfo" pp "github.com/anacrolix/torrent/peer_protocol" "github.com/anacrolix/torrent/storage" - "github.com/davecgh/go-spew/spew" - "github.com/dustin/go-humanize" - "golang.org/x/time/rate" ) func torrentBar(t *torrent.Torrent, pieceStates bool) { diff --git a/cmd/torrent/main.go b/cmd/torrent/main.go index 58a26663..2c1081bb 100644 --- a/cmd/torrent/main.go +++ b/cmd/torrent/main.go @@ -11,6 +11,10 @@ import ( "os" "time" + "github.com/anacrolix/bargle" + "github.com/anacrolix/envpprof" + "github.com/anacrolix/log" + xprometheus "github.com/anacrolix/missinggo/v2/prometheus" "github.com/davecgh/go-spew/spew" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -18,11 +22,6 @@ import ( "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc" "go.opentelemetry.io/otel/sdk/trace" - "github.com/anacrolix/bargle" - "github.com/anacrolix/envpprof" - "github.com/anacrolix/log" - xprometheus "github.com/anacrolix/missinggo/v2/prometheus" - "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/version" ) diff --git a/cmd/torrent/metainfo.go b/cmd/torrent/metainfo.go index f2a09ced..929cb45d 100644 --- a/cmd/torrent/metainfo.go +++ b/cmd/torrent/metainfo.go @@ -4,13 +4,14 @@ import ( "encoding/hex" "encoding/json" "fmt" + "net/http" "os" "strings" - "net/http" "github.com/anacrolix/bargle" - "github.com/anacrolix/torrent/metainfo" "github.com/bradfitz/iter" + + "github.com/anacrolix/torrent/metainfo" ) type pprintMetainfoFlags struct { diff --git a/cmd/torrent/scrape.go b/cmd/torrent/scrape.go index 56b9c70c..ce5fc06c 100644 --- a/cmd/torrent/scrape.go +++ b/cmd/torrent/scrape.go @@ -5,10 +5,10 @@ import ( "fmt" "net/url" - "github.com/anacrolix/torrent/tracker/udp" "github.com/davecgh/go-spew/spew" "github.com/anacrolix/torrent" + "github.com/anacrolix/torrent/tracker/udp" ) type scrapeCfg struct { diff --git a/cmd/torrent/serve.go b/cmd/torrent/serve.go index 0d3487d4..bdb15594 100644 --- a/cmd/torrent/serve.go +++ b/cmd/torrent/serve.go @@ -7,6 +7,7 @@ import ( "github.com/anacrolix/bargle" "github.com/anacrolix/log" + "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" diff --git a/config.go b/config.go index 1189872e..6f9f6827 100644 --- a/config.go +++ b/config.go @@ -11,12 +11,12 @@ import ( "github.com/anacrolix/dht/v2/krpc" "github.com/anacrolix/log" "github.com/anacrolix/missinggo/v2" - "github.com/anacrolix/torrent/version" "golang.org/x/time/rate" "github.com/anacrolix/torrent/iplist" "github.com/anacrolix/torrent/mse" "github.com/anacrolix/torrent/storage" + "github.com/anacrolix/torrent/version" ) // Probably not safe to modify this after it's given to a Client. diff --git a/fs/file_handle.go b/fs/file_handle.go index 147254d0..7c275c27 100644 --- a/fs/file_handle.go +++ b/fs/file_handle.go @@ -7,6 +7,7 @@ import ( "github.com/anacrolix/fuse" "github.com/anacrolix/fuse/fs" "github.com/anacrolix/missinggo/v2" + "github.com/anacrolix/torrent" ) diff --git a/misc.go b/misc.go index 6b638a28..99345fe7 100644 --- a/misc.go +++ b/misc.go @@ -6,12 +6,12 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/anacrolix/missinggo/v2" - "github.com/anacrolix/torrent/types" - "github.com/anacrolix/torrent/types/infohash" "golang.org/x/time/rate" "github.com/anacrolix/torrent/metainfo" pp "github.com/anacrolix/torrent/peer_protocol" + "github.com/anacrolix/torrent/types" + "github.com/anacrolix/torrent/types/infohash" ) type ( diff --git a/mmap_span/mmap_span.go b/mmap_span/mmap_span.go index d9970be4..de74956b 100644 --- a/mmap_span/mmap_span.go +++ b/mmap_span/mmap_span.go @@ -5,8 +5,9 @@ import ( "io" "sync" - "github.com/anacrolix/torrent/segments" "github.com/edsrzf/mmap-go" + + "github.com/anacrolix/torrent/segments" ) type MMapSpan struct { diff --git a/mse/cmd/mse/main.go b/mse/cmd/mse/main.go index 25f2e339..7d10a26d 100644 --- a/mse/cmd/mse/main.go +++ b/mse/cmd/mse/main.go @@ -9,6 +9,7 @@ import ( "sync" "github.com/alexflint/go-arg" + "github.com/anacrolix/torrent/mse" ) diff --git a/ordered-bitmap.go b/ordered-bitmap.go index 685ac62c..3be15c5b 100644 --- a/ordered-bitmap.go +++ b/ordered-bitmap.go @@ -2,8 +2,9 @@ package torrent import ( "github.com/anacrolix/generics" - "github.com/anacrolix/torrent/typed-roaring" list "github.com/bahlo/generic-list-go" + + "github.com/anacrolix/torrent/typed-roaring" ) type orderedBitmap[T typedRoaring.BitConstraint] struct { diff --git a/peer-impl.go b/peer-impl.go index 1b9cf978..b854ffd0 100644 --- a/peer-impl.go +++ b/peer-impl.go @@ -2,6 +2,7 @@ package torrent import ( "github.com/RoaringBitmap/roaring" + "github.com/anacrolix/torrent/metainfo" ) diff --git a/peer_protocol/pex.go b/peer_protocol/pex.go index bcf05f36..784aaa59 100644 --- a/peer_protocol/pex.go +++ b/peer_protocol/pex.go @@ -2,6 +2,7 @@ package peer_protocol import ( "github.com/anacrolix/dht/v2/krpc" + "github.com/anacrolix/torrent/bencode" ) diff --git a/peerconn.go b/peerconn.go index 4d978f07..7e872d2c 100644 --- a/peerconn.go +++ b/peerconn.go @@ -20,13 +20,14 @@ import ( "github.com/anacrolix/missinggo/iter" "github.com/anacrolix/missinggo/v2/bitmap" "github.com/anacrolix/multiless" + "golang.org/x/time/rate" + "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/mse" pp "github.com/anacrolix/torrent/peer_protocol" request_strategy "github.com/anacrolix/torrent/request-strategy" "github.com/anacrolix/torrent/typed-roaring" - "golang.org/x/time/rate" ) type PeerSource string diff --git a/pex.go b/pex.go index f274ac15..7fa0be88 100644 --- a/pex.go +++ b/pex.go @@ -6,6 +6,7 @@ import ( "time" "github.com/anacrolix/dht/v2/krpc" + pp "github.com/anacrolix/torrent/peer_protocol" ) diff --git a/piece.go b/piece.go index 3ef3576f..e08b2609 100644 --- a/piece.go +++ b/piece.go @@ -6,6 +6,7 @@ import ( "github.com/anacrolix/chansync" "github.com/anacrolix/missinggo/v2/bitmap" + "github.com/anacrolix/torrent/metainfo" pp "github.com/anacrolix/torrent/peer_protocol" "github.com/anacrolix/torrent/storage" diff --git a/request-strategy/order.go b/request-strategy/order.go index 8bdfe188..3b7284b2 100644 --- a/request-strategy/order.go +++ b/request-strategy/order.go @@ -5,8 +5,8 @@ import ( "expvar" "github.com/anacrolix/multiless" - "github.com/anacrolix/torrent/metainfo" + "github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/types" ) diff --git a/requesting.go b/requesting.go index a2ecbe40..47b3a1fe 100644 --- a/requesting.go +++ b/requesting.go @@ -11,10 +11,10 @@ import ( "github.com/anacrolix/log" "github.com/anacrolix/multiless" - "github.com/anacrolix/torrent/typed-roaring" "github.com/lispad/go-generics-tools/binheap" "github.com/anacrolix/torrent/request-strategy" + "github.com/anacrolix/torrent/typed-roaring" ) func (t *Torrent) requestStrategyPieceOrderState(i int) request_strategy.PieceRequestOrderState { diff --git a/smartban.go b/smartban.go index 15b4d44b..96cc2acf 100644 --- a/smartban.go +++ b/smartban.go @@ -6,6 +6,7 @@ import ( "net/netip" "github.com/anacrolix/generics" + "github.com/anacrolix/torrent/smartban" ) diff --git a/socket.go b/socket.go index aee11df8..127cd29a 100644 --- a/socket.go +++ b/socket.go @@ -8,8 +8,9 @@ import ( "github.com/anacrolix/log" "github.com/anacrolix/missinggo/perf" "github.com/anacrolix/missinggo/v2" - "github.com/anacrolix/torrent/dialer" "github.com/pkg/errors" + + "github.com/anacrolix/torrent/dialer" ) type Listener interface { diff --git a/sources.go b/sources.go index a03b7675..3923e8e6 100644 --- a/sources.go +++ b/sources.go @@ -6,6 +6,7 @@ import ( "net/http" "github.com/anacrolix/log" + "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" ) diff --git a/storage/file.go b/storage/file.go index d07dc7e9..b8739647 100644 --- a/storage/file.go +++ b/storage/file.go @@ -7,10 +7,10 @@ import ( "path/filepath" "github.com/anacrolix/missinggo/v2" - "github.com/anacrolix/torrent/common" - "github.com/anacrolix/torrent/segments" + "github.com/anacrolix/torrent/common" "github.com/anacrolix/torrent/metainfo" + "github.com/anacrolix/torrent/segments" ) // File-based storage for torrents, that isn't yet bound to a particular torrent. diff --git a/storage/sqlite-piece-completion.go b/storage/sqlite-piece-completion.go index eb2e1c3d..662b1e98 100644 --- a/storage/sqlite-piece-completion.go +++ b/storage/sqlite-piece-completion.go @@ -13,6 +13,7 @@ import ( "crawshaw.io/sqlite" "crawshaw.io/sqlite/sqlitex" + "github.com/anacrolix/torrent/metainfo" ) diff --git a/storage/test/bench-piece-mark-complete.go b/storage/test/bench-piece-mark-complete.go index e800e6a9..71b27afc 100644 --- a/storage/test/bench-piece-mark-complete.go +++ b/storage/test/bench-piece-mark-complete.go @@ -6,9 +6,10 @@ import ( "sync" "testing" + qt "github.com/frankban/quicktest" + "github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/storage" - qt "github.com/frankban/quicktest" ) const ( diff --git a/storage/wrappers.go b/storage/wrappers.go index 5a4fda08..a3907e1d 100644 --- a/storage/wrappers.go +++ b/storage/wrappers.go @@ -5,6 +5,7 @@ import ( "os" "github.com/anacrolix/missinggo/v2" + "github.com/anacrolix/torrent/metainfo" ) diff --git a/test/leecher-storage.go b/test/leecher-storage.go index 49da4182..eac152d6 100644 --- a/test/leecher-storage.go +++ b/test/leecher-storage.go @@ -9,13 +9,14 @@ import ( "testing/iotest" "github.com/anacrolix/missinggo/v2/bitmap" - "github.com/anacrolix/torrent" - "github.com/anacrolix/torrent/internal/testutil" - "github.com/anacrolix/torrent/storage" "github.com/frankban/quicktest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "golang.org/x/time/rate" + + "github.com/anacrolix/torrent" + "github.com/anacrolix/torrent/internal/testutil" + "github.com/anacrolix/torrent/storage" ) type LeecherStorageTestCase struct { diff --git a/testing.go b/testing.go index 684b2eb7..1df8abc0 100644 --- a/testing.go +++ b/testing.go @@ -5,6 +5,7 @@ import ( "time" "github.com/anacrolix/log" + pp "github.com/anacrolix/torrent/peer_protocol" ) diff --git a/torrent.go b/torrent.go index 7d32b957..71b2fc9f 100644 --- a/torrent.go +++ b/torrent.go @@ -30,8 +30,6 @@ import ( "github.com/anacrolix/missinggo/v2/pubsub" "github.com/anacrolix/multiless" "github.com/anacrolix/sync" - request_strategy "github.com/anacrolix/torrent/request-strategy" - typedRoaring "github.com/anacrolix/torrent/typed-roaring" "github.com/davecgh/go-spew/spew" "github.com/pion/datachannel" @@ -39,9 +37,11 @@ import ( "github.com/anacrolix/torrent/common" "github.com/anacrolix/torrent/metainfo" pp "github.com/anacrolix/torrent/peer_protocol" + request_strategy "github.com/anacrolix/torrent/request-strategy" "github.com/anacrolix/torrent/segments" "github.com/anacrolix/torrent/storage" "github.com/anacrolix/torrent/tracker" + typedRoaring "github.com/anacrolix/torrent/typed-roaring" "github.com/anacrolix/torrent/webseed" "github.com/anacrolix/torrent/webtorrent" ) diff --git a/tracker/client.go b/tracker/client.go index 2558da70..1aaf2561 100644 --- a/tracker/client.go +++ b/tracker/client.go @@ -6,6 +6,7 @@ import ( "net/url" "github.com/anacrolix/log" + trHttp "github.com/anacrolix/torrent/tracker/http" "github.com/anacrolix/torrent/tracker/udp" ) diff --git a/tracker/http/client.go b/tracker/http/client.go index cd18f65a..7b2a32d1 100644 --- a/tracker/http/client.go +++ b/tracker/http/client.go @@ -29,7 +29,7 @@ func NewClient(url_ *url.URL, opts NewClientOpts) Client { hc: &http.Client{ Transport: &http.Transport{ DialContext: opts.DialContext, - Proxy: opts.Proxy, + Proxy: opts.Proxy, TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, ServerName: opts.ServerName, diff --git a/tracker/http/http.go b/tracker/http/http.go index deee4ded..72a95c38 100644 --- a/tracker/http/http.go +++ b/tracker/http/http.go @@ -14,6 +14,7 @@ import ( "strings" "github.com/anacrolix/missinggo/httptoo" + "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/tracker/shared" "github.com/anacrolix/torrent/tracker/udp" diff --git a/tracker/http/protocol.go b/tracker/http/protocol.go index 0a54a1b3..aa6d78d4 100644 --- a/tracker/http/protocol.go +++ b/tracker/http/protocol.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/anacrolix/dht/v2/krpc" + "github.com/anacrolix/torrent/bencode" ) diff --git a/tracker/tracker.go b/tracker/tracker.go index a9721c77..122278b6 100644 --- a/tracker/tracker.go +++ b/tracker/tracker.go @@ -11,6 +11,7 @@ import ( "github.com/anacrolix/dht/v2/krpc" "github.com/anacrolix/log" + trHttp "github.com/anacrolix/torrent/tracker/http" "github.com/anacrolix/torrent/tracker/shared" "github.com/anacrolix/torrent/tracker/udp" diff --git a/tracker/udp/conn-client.go b/tracker/udp/conn-client.go index f500fc3f..f379d857 100644 --- a/tracker/udp/conn-client.go +++ b/tracker/udp/conn-client.go @@ -5,7 +5,6 @@ import ( "net" "github.com/anacrolix/log" - "github.com/anacrolix/missinggo/v2" ) diff --git a/util/dirwatch/dirwatch.go b/util/dirwatch/dirwatch.go index 94d22e3a..f617aee7 100644 --- a/util/dirwatch/dirwatch.go +++ b/util/dirwatch/dirwatch.go @@ -10,8 +10,9 @@ import ( "github.com/anacrolix/log" "github.com/anacrolix/missinggo/v2" - "github.com/anacrolix/torrent/metainfo" "github.com/fsnotify/fsnotify" + + "github.com/anacrolix/torrent/metainfo" ) type Change uint diff --git a/webrtc.go b/webrtc.go index aff1e0a3..ca4f80fb 100644 --- a/webrtc.go +++ b/webrtc.go @@ -1,16 +1,17 @@ package torrent import ( - "go.opentelemetry.io/otel" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/trace" "net" "strconv" "time" - "github.com/anacrolix/torrent/webtorrent" "github.com/pion/datachannel" "github.com/pion/webrtc/v3" + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/trace" + + "github.com/anacrolix/torrent/webtorrent" ) const webrtcNetwork = "webrtc" diff --git a/webseed-peer.go b/webseed-peer.go index 40110094..52e33c72 100644 --- a/webseed-peer.go +++ b/webseed-peer.go @@ -10,6 +10,7 @@ import ( "github.com/RoaringBitmap/roaring" "github.com/anacrolix/log" + "github.com/anacrolix/torrent/metainfo" pp "github.com/anacrolix/torrent/peer_protocol" "github.com/anacrolix/torrent/webseed" diff --git a/webseed/client.go b/webseed/client.go index a86be17a..ac42b8a4 100644 --- a/webseed/client.go +++ b/webseed/client.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/RoaringBitmap/roaring" + "github.com/anacrolix/torrent/common" "github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/segments" diff --git a/webtorrent/tracker-client.go b/webtorrent/tracker-client.go index 195c06b0..64885bf4 100644 --- a/webtorrent/tracker-client.go +++ b/webtorrent/tracker-client.go @@ -5,17 +5,17 @@ import ( "crypto/rand" "encoding/json" "fmt" - "github.com/anacrolix/generics" - "go.opentelemetry.io/otel/trace" "sync" "time" + "github.com/anacrolix/generics" "github.com/anacrolix/log" - - "github.com/anacrolix/torrent/tracker" "github.com/gorilla/websocket" "github.com/pion/datachannel" "github.com/pion/webrtc/v3" + "go.opentelemetry.io/otel/trace" + + "github.com/anacrolix/torrent/tracker" ) type TrackerClientStats struct { diff --git a/webtorrent/transport.go b/webtorrent/transport.go index d60fb7a7..610301db 100644 --- a/webtorrent/transport.go +++ b/webtorrent/transport.go @@ -4,6 +4,10 @@ import ( "context" "expvar" "fmt" + "io" + "sync" + "time" + "github.com/anacrolix/log" "github.com/anacrolix/missinggo/v2/pproffd" "github.com/pion/datachannel" @@ -12,9 +16,6 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/trace" - "io" - "sync" - "time" ) const ( diff --git a/wstracker.go b/wstracker.go index 4ed5a599..431863a0 100644 --- a/wstracker.go +++ b/wstracker.go @@ -8,12 +8,12 @@ import ( "sync" "github.com/anacrolix/log" - "github.com/anacrolix/torrent/tracker/http" "github.com/gorilla/websocket" + "github.com/pion/datachannel" "github.com/anacrolix/torrent/tracker" + "github.com/anacrolix/torrent/tracker/http" "github.com/anacrolix/torrent/webtorrent" - "github.com/pion/datachannel" ) type websocketTrackerStatus struct {