DHT- BitTorrent DHT 协议的 GO 实现
Google Go 其他开发相关
访问GitHub主页
共0Star
详细介绍
DHT 是BitTorrent DHT 协议的实现,采用Go语言。主要包括以下部分:
展示截图:
安装:
go get github.com/shiyanhui/dht
使用示例:
import (
"fmt"
"github.com/shiyanhui/dht"
)
func main() {
downloader := dht.NewWire()
go func() {
// once we got the request result
for resp := range downloader.Response() {
fmt.Println(resp.InfoHash, resp.MetadataInfo)
}
}()
go downloader.Run()
config := dht.NewCrawlConfig()
config.OnAnnouncePeer = func(infoHash, ip string, port int) {
// request to download the metadata info
downloader.Request([]byte(infoHash), ip, port)
}
d := dht.New(config)
d.Run()
}
推荐源码
-
2292 Star
-
0 Star
-
572 Star
-
243 Star
-
2305 Star
-
1190 Star
-
285 Star
-
0 Star
-
4417 Star