Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bitfield ¶
type Bitfield []byte
Bitfield is byte array which stores the index of the parts available with a particular client
func (Bitfield) CheckPiece ¶
CheckPiece tells if a bitfield has a particular index set
type Client ¶
type Client struct { Conn net.Conn Choked bool Bitfield Bitfield // contains filtered or unexported fields }
A Client is a TCP connection with a peer
func New ¶
New connects with a peer, completes a handshake, and receives a handshake returns an err if any of those fail.
func (*Client) ReadMessageFromPeer ¶
ReadMessageFromPeer read the peers response after handshake,i.e interprets have,choked,unchoked,and Piece messages
func (*Client) SendInterested ¶
SendInterested sends an Interested message to the peer
func (*Client) SendRequest ¶
SendRequest sends a Request message to the peer
func (*Client) SendUnchoke ¶
SendUnchoke sends an Unchoke message to the peer
Click to show internal directories.
Click to hide internal directories.