torrentfile

package
v0.0.0-...-d25a9c8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: GPL-3.0, GPL-3.0-only Imports: 5 Imported by: 0

Documentation

Overview

Modified package from https://github.com/veggiedefender/torrent-client used for parsing torrent files and computing info hashes.

Index

Constants

View Source
const Port uint16 = 6881

Port to listen on

Variables

This section is empty.

Functions

This section is empty.

Types

type BencodeTorrent

type BencodeTorrent struct {
	Announce string      `bencode:"announce"`
	Info     bencodeInfo `bencode:"info"`
}

func Unmarshal

func Unmarshal(r io.Reader) (BencodeTorrent, error)

func (*BencodeTorrent) ToTorrentFile

func (bto *BencodeTorrent) ToTorrentFile() (TorrentFile, error)

type TorrentFile

type TorrentFile struct {
	Announce    string
	InfoHash    []byte
	PieceHashes [][20]byte
	PieceLength int
	Length      int
	Name        string
}

TorrentFile encodes the metadata from a .torrent file

Jump to

Keyboard shortcuts

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