message

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: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgChoke         messageID = 0
	MsgUnchoke       messageID = 1
	MsgInterested    messageID = 2
	MsgNotInterested messageID = 3
	MsgHave          messageID = 4
	MsgBitfield      messageID = 5
	MsgRequest       messageID = 6
	MsgPiece         messageID = 7
	MsgCancel        messageID = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ID      messageID
	Payload []byte
}

func FormatHave

func FormatHave(index int) *Message

FormatHave create a HAVE message

func FormatRequest

func FormatRequest(index, begin, length int) *Message

FormatRequest create a REUQEST message

func Read

func Read(r io.Reader) (*Message, error)

func (*Message) Serialize

func (m *Message) Serialize() []byte

Jump to

Keyboard shortcuts

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