Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example usage:

type Foo struct {
    Name string `bencode:"name"`
    Value int `bencode:"value"`
    OptionalList []int `bencode:"?list"` // '?' means that the key is optional
}

func main() {
    foo := Foo{}
    err := bencode.Unmarshal([]byte("d4:name6:b0nbun5:valuei999e4:listli1ei2ei3eee"), &foo)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(foo) // {b0nbun 999 [1 2 3]}
}

About

A simplistic Go bencode marshaller/unmarshaller

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages