There are already a few Go packages that implement bencoding, but I haven't found any that work similarly to encoding/json (where you pass a value to be encoded/decoded and don't have to think about interfaces or type checks at all). This one isn't super advanced (it only supports byte slices, ints, slices, and structs with tags); I tried to keep it minimal as I feel encoding/json goes a bit too far and presents an overwhelming interface. I hope somebody finds it useful. Criticism welcome.
评论:
justinisrael:
md2perpe:I read the name of this project as Gob Encode (Go native encoding format)
tumdum:Me to. If it's possible to change the name to go-bencode, I think that would be good.
Here is my old go bencoding library inspired by std lib: https://github.com/tumdum/bencoding
