1
0
mirror of https://github.com/veggiedefender/torrent-client.git synced 2025-11-06 09:29:16 +02:00

Stub out p2p interface

This commit is contained in:
Jesse
2019-12-22 22:25:57 -05:00
parent b7cccc4662
commit 519d64fa9a
2 changed files with 25 additions and 39 deletions

View File

@@ -47,16 +47,15 @@ func (t *Torrent) Download() error {
// peers, err := t.getPeers(peerID, Port)
// fmt.Println(peers)
localhost := p2p.Peer{
IP: net.IP{127, 0, 0, 1},
Port: 51413,
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,
}
err = p2p.Connect(&localhost, peerID, t.InfoHash)
if err != nil {
return nil
}
return nil
err := downloader.Download()
return err
}
// Open parses a torrent file