You've already forked torrent-client
mirror of
https://github.com/veggiedefender/torrent-client.git
synced 2025-11-06 09:29:16 +02:00
Implement handshake.New()
This commit is contained in:
@@ -100,11 +100,7 @@ func (p *Peer) connect(peerID [20]byte, infoHash [20]byte) (net.Conn, error) {
|
||||
}
|
||||
|
||||
func (d *Downloader) handshake(conn net.Conn) (*handshake.Handshake, error) {
|
||||
req := handshake.Handshake{
|
||||
Pstr: "BitTorrent protocol",
|
||||
InfoHash: d.InfoHash,
|
||||
PeerID: d.PeerID,
|
||||
}
|
||||
req := handshake.New(d.InfoHash, d.PeerID)
|
||||
_, err := conn.Write(req.Serialize())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user