From 12fac89ce58d31aff83bf5663dabadd151d07625 Mon Sep 17 00:00:00 2001 From: Jesse Date: Sun, 22 Dec 2019 22:37:27 -0500 Subject: [PATCH] Remove PieceLength from Downloader struct --- p2p/p2p.go | 7 +++---- torrent/torrent.go | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/p2p/p2p.go b/p2p/p2p.go index 5d66585..8d0d461 100644 --- a/p2p/p2p.go +++ b/p2p/p2p.go @@ -13,10 +13,9 @@ type Peer struct { // Downloader holds data required to download a torrent from a list of peers type Downloader struct { - Peers []Peer - InfoHash [20]byte - PieceLength int - Length int + Peers []Peer + InfoHash [20]byte + Length int } // Download downloads a torrent diff --git a/torrent/torrent.go b/torrent/torrent.go index 667fcfe..10a4cae 100644 --- a/torrent/torrent.go +++ b/torrent/torrent.go @@ -49,10 +49,9 @@ func (t *Torrent) Download() error { // fmt.Println(peers) peers := []p2p.Peer{{IP: net.IP{127, 0, 0, 1}, Port: 51413}} downloader := p2p.Downloader{ - Peers: peers, - InfoHash: t.InfoHash, - PieceLength: t.PieceLength, - Length: t.Length, + Peers: peers, + InfoHash: t.InfoHash, + Length: t.Length, } err = downloader.Download() return err