gotorrentparser

package module
v0.0.0-...-1673ab2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

A CLI tool for getting .torrent file info without downloading the file and lightweight library for parsing torrent files written in Go

torrent-info ~/torrents/xyz1243.torrent
# outputs
File: /home/sweet/torrents/08/9f/082a0c0f8e0823d8a18e2324f1c192477514f49f.torrent
Hash: 082a0c0f8e0823d8a18e2324f1c192477514f49f

-----Files------
Sonic.The.Hedgehog.2020.Remux.1080p.mkv
----------------

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// Relative path of the file
	Path []string

	// File length
	Length int64
}

type FileMetadata

type FileMetadata struct {
	Path     []string `bencode:"path"`
	PathUtf8 []string `bencode:"path.utf-8"`
	Length   int64    `bencode:"length"`
}

type InfoMetadata

type InfoMetadata struct {
	PieceLength int64  `bencode:"piece length"`
	Pieces      []byte `bencode:"pieces"`

	// single file context
	Name     string `bencode:"name"`
	NameUtf8 string `bencode:"name.utf-8"`
	Length   int64  `bencode:"length"`

	// multi file context
	Files bencode.RawMessage `bencode:"files"`
}

type Metadata

type Metadata struct {
	// Foobar   []interface{} `bencode:"announce-list"`
	Announce     string             `bencode:"announce"`
	AnnounceList [][]string         `bencode:"announce-list"`
	Comment      string             `bencode:"comment"`
	CreatedBy    string             `bencode:"created by"`
	CreatedAt    int64              `bencode:"creation date"`
	Info         bencode.RawMessage `bencode:"info"`
}

type Torrent

type Torrent struct {
	// Announce URL
	Announce []string

	// Torrent comment
	Comment string

	// Author
	CreatedBy string

	// Creation time
	CreatedAt time.Time

	// Torrent SHA1
	InfoHash string

	Files []*File
}

func Parse

func Parse(reader io.Reader) (*Torrent, error)

func ParseFromFile

func ParseFromFile(path string) (*Torrent, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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