mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 14:53:44 +00:00
简单实现peer wire protocol协议
This commit is contained in:
1 parent
ae1c605143
commit
fb45066228
13 files changed
+859
-404
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package torrent
|
||||
|
||||
import (
|
||||
"github.com/monkeyWie/gopeed/down/bt/metainfo"
|
||||
"github.com/monkeyWie/gopeed/down/bt/peer"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTorrent_Download(t *testing.T) {
|
||||
torrent := buildTorrent()
|
||||
torrent.Download("e:/testbt/download")
|
||||
}
|
||||
|
||||
func buildTorrent() *Torrent {
|
||||
metaInfo, err := metainfo.ParseFromFile("../testdata/Game.of.Thrones.S08E05.720p.WEB.H264-MEMENTO.torrent")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// metaInfo.Announce = "udp://exodus.desync.com:6969/announce"
|
||||
// metaInfo.Announce = "udp://tracker.openbittorrent.com:80/announce"
|
||||
// metaInfo.Announce = "udp://tracker.cyberia.is:6969/announce"
|
||||
// metaInfo.Announce = "udp://9.rarbg.me:2780/announce"
|
||||
// metaInfo.Announce = "udp://9.rarbg.to:2760/announce"
|
||||
// metaInfo.Announce = "udp://tracker.leechers-paradise.org:6969"
|
||||
metaInfo.AnnounceList = [][]string{}
|
||||
metaInfo.AnnounceList = append(metaInfo.AnnounceList, []string{
|
||||
"udp://exodus.desync.com:6969/announce",
|
||||
"udp://tracker.openbittorrent.com:80/announce",
|
||||
"udp://tracker.leechers-paradise.org:6969",
|
||||
})
|
||||
return NewTorrent(peer.GenPeerID(), metaInfo)
|
||||
}
|
||||
Reference in new issue
Block a user