parser

package
v0.0.0-...-7c8d4e0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Xunlei   = "http://bt.box.n0808.com/%s/%s/%s.torrent"
	Torcache = "https://torcache.net/torrent/%s.torrent"
	Itorrent = "http://itorrents.org/torrent/%s.torrent"
)

define address

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
	LibUrls     = []string{

		"http://itorrents.org/torrent/%s.torrent",
	}
)

define errors

Functions

This section is empty.

Types

type FileDict

type FileDict struct {
	Length int64    `json:"length"`
	Path   []string `json:"path"`
	Md5sum string   `json:"md5sum"`
}

FileDict into which torrent metafile is parsed and stored into.

type InfoDict

type InfoDict struct {
	FileDuration []int64 `json:"file-duration"`
	FileMedia    []int64 `json:"file-media"`
	// Single file
	Name   string `json:"name"`
	Length int64  `json:"length"`
	Md5sum string `json:"md5sum"`
	// Multiple files
	Files       []FileDict `json:"files"`
	PieceLength int64      `json:"piece length"`
	Pieces      string     `json:"-"`
	Private     int64      `json:"-"`
}

InfoDict define

type MetaInfo

type MetaInfo struct {
	Info         InfoDict   `json:"info"`
	InfoHash     string     `json:"info hash"`
	Announce     string     `json:"announce"`
	AnnounceList [][]string `json:"announce-list"`
	CreationDate int64      `json:"creation date"`
	Comment      string     `json:"comment"`
	CreatedBy    string     `json:"created by"`
	Encoding     string     `json:"encoding"`
}

MetaInfo define

func DownloadTorrent

func DownloadTorrent(hash string, client *http.Client) (mi MetaInfo, err error)

DownloadTorrent

func DownloadXunlei

func DownloadXunlei(hash string, client *http.Client) (mi MetaInfo, err error)

DownloadXunlei torrent

func (*MetaInfo) Parse

func (metaInfo *MetaInfo) Parse(r io.Reader) (err error)

Parse Open .torrent file, un-bencode it and load them into MetaInfo struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL