Golang
文章平均质量分 92
Exler_yz
这个作者很懒,什么都没留下…
展开
-
Golang ------ torrent文件下载 (2)
Golang ------ torrent文件解析Golang ------ torrent文件下载 (1)Golang ------ torrent文件下载 (2)在上一篇的最后我们获取到了peer列表,那么接下去我们就要跟peer列表中的每个节点建立连接,然后请求获取文件分片的具体内容了。请求文件// Download downloads the torrent. This stores the entire file in memory.func (t *Torrent) Downlo.原创 2021-05-31 18:44:40 · 649 阅读 · 3 评论 -
Golang ------ torrent文件下载 (1)
以 debian-10.9.0-amd64-netinst.iso 为例debian操作系统下载页种子下载页种子链接d 8:announce 41:http://bttracker.debian.org:6969/announce 7:comment 35:"Debian CD from cdimage.debian.org" 13:creation date i1616846384e 9:httpseeds l145:https://cdimage.原创 2021-05-28 17:51:53 · 2096 阅读 · 3 评论 -
Golang------cobra
安装go get -u github.com/spf13/cobra/cobra在pkg\mod\github.com\spf13\[email protected]\cobra中执行go build把生成的cobra.exe放到go的bin目录下,便于全局执行命令新建一个项目文件夹,在文件夹里面执行cobra init --pkg-name CobraDemo默认会创建一个cmd文件夹里面有一个root.go文件我添加了一个go.mod文件用于管理依赖go.modmodule CobraD原创 2020-12-21 20:24:29 · 138 阅读 · 0 评论 -
Golang ------ torrent文件解析
bencode编码.torrent文件使用的是它独有的bencode编码。支持下列类型:字节串、整数、列表和字典。1.字符串:<字符串的长度>:<字符串的内容>例如:announce,编码后为 8:announcename,编码后为 4:name2.数字的存储格式: i<十进制整型数>e例如:4,编码后为 i4e1024,编码后为 i1024e3.列表的存储格式:l<子元素>e子元素可以是字符串,整数,列表和字典,或者是它们的组合体例原创 2021-05-27 11:07:32 · 1583 阅读 · 0 评论