torrent

package
v0.0.0-...-fb43f42 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessagePeer

func MessagePeer(peer *peer.PeerState)

func Start

func Start(path string, options ...func(*conf.Flags))

Types

type ActivePiece

type ActivePiece struct {
	// contains filtered or unexported fields
}

type ExtensionHandshake

type ExtensionHandshake struct {
	M      map[string]int `bencode:"m"`
	P      uint16         `bencode:"p"`
	V      string         `bencode:"v"`
	Yourip string         `bencode:"yourip"`
	Ipv6   string         `bencode:"ipv6"`
	Ipv4   string         `bencode:"ipv4"`
	Reqq   uint16         `bencode:"reqq"`

	MetadataSize uint `bencode:"metadata_size"`
}

type MetadataMessage

type MetadataMessage struct {
	MsgType   uint8 `bencode:"msg_type"`
	Piece     uint  `bencode:"piece"`
	TotalSize uint  `bencode:"total_size"`
}

type TorrentSession

type TorrentSession struct {
	M       *meta.MetaInfo
	Session meta.SessionInfo
	// contains filtered or unexported fields
}

func NewTorrentSession

func NewTorrentSession(flags *conf.Flags, torrent string, listenPort uint16) (t *TorrentSession, err error)

func (*TorrentSession) AcceptNewPeer

func (ts *TorrentSession) AcceptNewPeer(btconn *listen.BtConn)

func (*TorrentSession) AddPeer

func (ts *TorrentSession) AddPeer(btconn *listen.BtConn)

Can be called from any goroutine

func (*TorrentSession) ChoosePiece

func (ts *TorrentSession) ChoosePiece(p *peer.PeerState) (piece int)

func (*TorrentSession) ClosePeer

func (ts *TorrentSession) ClosePeer(peer *peer.PeerState)

func (*TorrentSession) DoExtension

func (ts *TorrentSession) DoExtension(msg []byte, p *peer.PeerState) (err error)

func (*TorrentSession) DoMessage

func (ts *TorrentSession) DoMessage(p *peer.PeerState, message []byte) (err error)

func (*TorrentSession) DoMetadata

func (ts *TorrentSession) DoMetadata(msg []byte, p *peer.PeerState)

func (*TorrentSession) DoTorrent

func (ts *TorrentSession) DoTorrent()

func (*TorrentSession) Header

func (ts *TorrentSession) Header() (header []byte)

func (*TorrentSession) HintNewPeer

func (ts *TorrentSession) HintNewPeer(peer string)

Try to connect if the peer is not already in our peers. Can be called from any goroutine.

func (*TorrentSession) Quit

func (ts *TorrentSession) Quit() (err error)

func (*TorrentSession) RecordBlock

func (ts *TorrentSession) RecordBlock(p *peer.PeerState, piece, begin, length uint32) (err error)

func (*TorrentSession) RequestBlock

func (ts *TorrentSession) RequestBlock(p *peer.PeerState) error

func (*TorrentSession) RequestBlock2

func (ts *TorrentSession) RequestBlock2(p *peer.PeerState, piece int, endGame bool) (err error)

func (*TorrentSession) Shutdown

func (ts *TorrentSession) Shutdown() (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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