Documentation

Index

Constants

View Source
const (
	GreetingFileContents = "hello, world\n"
	GreetingFileName     = "greeting"
)

Variables

View Source
var Greeting = Torrent{
	Files: []File{{
		Data: GreetingFileContents,
	}},
	Name: GreetingFileName,
}

Functions

func CreateDummyTorrentData

func CreateDummyTorrentData(dirName string) string

func ExportStatusWriter

func ExportStatusWriter(sw StatusWriter, path string) (release func())

func GreetingMetaInfo

func GreetingMetaInfo() *metainfo.MetaInfo

func GreetingTestTorrent

func GreetingTestTorrent() (tempDir string, metaInfo *metainfo.MetaInfo)

Gives a temporary directory containing the completed "greeting" torrent, and a corresponding metainfo describing it. The temporary directory can be cleaned away with os.RemoveAll.

Types

type File

type File struct {
	Name string
	Data string
}

type StatusWriter

type StatusWriter interface {
	WriteStatus(io.Writer)
}

type Torrent

type Torrent struct {
	Files []File
	Name  string
}

func (*Torrent) GetFile

func (t *Torrent) GetFile(name string) *File

func (*Torrent) Info

func (t *Torrent) Info(pieceLength int64) metainfo.Info

func (*Torrent) IsDir

func (t *Torrent) IsDir() bool

func (*Torrent) Metainfo

func (t *Torrent) Metainfo(pieceLength int64) *metainfo.MetaInfo