【文件属性】:
文件名称:bencode:Go中的Bencode实现
文件大小:5KB
文件格式:ZIP
更新时间:2021-04-06 04:17:43
torrent bencode Go
本码
Go中的Bencode实现
受到启发
安装
$ go get github.com/impos/bencode
用法
编码
bencode.Encode使用map [string] interface {}作为参数并返回([] byte,错误)。 例子:
package main
import (
"fmt"
"log"
"github.com/impos/bencode"
)
func main () {
dict := map [ string ] interface {}{}
dict [ "int key" ] = 123456
dict [ "string key" ] = "hello world"
dict [ "bytes key" ] = [] byte ( "hello world" )
dict [ "list key" ] = [] inte
【文件预览】:
bencode-main
----helpers.go(229B)
----go.mod(41B)
----decoder.go(4KB)
----LICENSE(1KB)
----README.md(1KB)
----encoder.go(3KB)