Versions in this module Expand all Collapse all v0 v0.1.3 Aug 26, 2019 Changes in this version + type FakePeer struct + func NewFakePeer() (*FakePeer, error) + func (p *FakePeer) Addr() string + func (p *FakePeer) Close() + func (p *FakePeer) PeerID() core.PeerID + func (p *FakePeer) PeerInfo() *core.PeerInfo v0.1.2 Apr 9, 2019 Changes in this version type Conn + func (c *Conn) Start() v0.1.0 Feb 23, 2019 Changes in this version + func PipeFixture(config Config, info *storage.TorrentInfo) (local *Conn, remote *Conn, cleanupFunc func()) + type Config struct + Bandwidth bandwidth.Config + HandshakeTimeout time.Duration + ReceiverBufferSize int + SenderBufferSize int + func ConfigFixture() Config + type Conn struct + func Fixture() (*Conn, func()) + func (c *Conn) Close() + func (c *Conn) CreatedAt() time.Time + func (c *Conn) InfoHash() core.InfoHash + func (c *Conn) IsClosed() bool + func (c *Conn) PeerID() core.PeerID + func (c *Conn) Receiver() <-chan *Message + func (c *Conn) Send(msg *Message) error + func (c *Conn) String() string + type Events interface + ConnClosed func(*Conn) + type HandshakeResult struct + Bitfield *bitset.BitSet + Conn *Conn + RemoteBitfields RemoteBitfields + type Handshaker struct + func HandshakerFixture(config Config) *Handshaker + func NewHandshaker(config Config, stats tally.Scope, clk clock.Clock, ...) (*Handshaker, error) + func (h *Handshaker) Accept(nc net.Conn) (*PendingConn, error) + func (h *Handshaker) Establish(pc *PendingConn, info *storage.TorrentInfo, remoteBitfields RemoteBitfields) (*Conn, error) + func (h *Handshaker) Initialize(peerID core.PeerID, addr string, info *storage.TorrentInfo, ...) (*HandshakeResult, error) + type Message struct + Message *p2p.Message + Payload storage.PieceReader + func NewAnnouncePieceMessage(index int) *Message + func NewCompleteMessage() *Message + func NewErrorMessage(index int, code p2p.ErrorMessage_ErrorCode, err error) *Message + func NewPiecePayloadMessage(index int, pr storage.PieceReader) *Message + func NewPieceRequestMessage(index int, length int64) *Message + type PendingConn struct + func (pc *PendingConn) Bitfield() *bitset.BitSet + func (pc *PendingConn) Close() + func (pc *PendingConn) Digest() core.Digest + func (pc *PendingConn) InfoHash() core.InfoHash + func (pc *PendingConn) Namespace() string + func (pc *PendingConn) PeerID() core.PeerID + func (pc *PendingConn) RemoteBitfields() RemoteBitfields + type RemoteBitfields map[core.PeerID]*bitset.BitSet