package module
Version: v0.0.0-...-025fffd Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2014 License: GPL-2.0 Imports: 6 Imported by: 0



Parses bittorrent files. Atm it assumes there is a "master dictionary" with an info dictionary inside of it (This is what sais). Dictionariy keys are assumed to only be strings, while values can be anything ( Will implement torrent encoding later when the main torrent client are done.




This section is empty.


This section is empty.


func GetInfoDict

func GetInfoDict(m map[string]interface{}) (map[string]interface{}, error)

Gets the info dict out of a main dict, returns nil if it doesn't exists

func GetInfoHash

func GetInfoHash(tData []byte) (hash.Hash, error)

func GetMainDict

func GetMainDict(tData []byte) (map[string]interface{}, error)

Reads in the torrentfile f_name and assumes that the torrent just have one main dict item (altough the main dict can contain arbitrary many items). The dict itself is assumed to only have strings or ints as keys (Altough both are represented as strings) the value can be anything and is returned as an interface{}, type assertion is needed to properly access the value.

func GetStringListFromDict

func GetStringListFromDict(key string, dict map[string]interface{}) ([]string, error)

Gets a string list value from a dictionary (or map[string]Interface{}) that has the key value "key". These reflection things are subtle and recommended reading is, and the The "fmt" source code.

If there is diffrent list-values in a list you'll have to implement your own corresponding function. The string list value is so common that this function is included ;)


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL