client

package
v0.0.0-...-287ff3b Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Conn     net.Conn
	Bitfield bitfield.Bitfield
	PeerID   [20]byte
	InfoHash [20]byte
	Peer     peers.Peer
	// Choked is true if the peer is choked
	Choked bool
}

func New

func New(p peers.Peer, id, infoHash [20]byte) (*Client, error)

func (*Client) Read

func (c *Client) Read() (*message.Message, error)

func (*Client) SendInterested

func (c *Client) SendInterested() error

SendInterested sends an Interested message to the peer

func (*Client) SendNotInterested

func (c *Client) SendNotInterested() error

SendNotInterested sends a NotInterested message to the peer

func (*Client) SendRequest

func (c *Client) SendRequest(index, begin, length int) error

func (*Client) SendUnchoke

func (c *Client) SendUnchoke() error

SendUnchoke sends an Unchoke message to the peer

Jump to

Keyboard shortcuts

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