DHT BitTorrent DHT 协议的 GO 实现 DHT

blov2016-08-29 04:00:02 • 4651 次点击    
这是一个分享于 2016-08-29 04:00:02 的项目,其中的信息可能已经有所发展或是发生改变。

DHT 是BitTorrent DHT 协议的实现,采用Go语言。主要包括以下部分:

* BEP-3 (part)

* BEP-5

* BEP-9

* BEP-10

展示截图:

image

安装:

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()
}

BitTorrent DHT Protocol && DHT Spider.Read More

Latest commit to the master branch on 8-17-2021
Download as zip
授权协议:
MIT
开发语言:
Google Go 查看源码»
操作系统:
跨平台
4651 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传