message

package
v0.0.0-...-ace0c27 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgChoke        messageID = 0
	MsgUnChoke      messageID = 1
	MsgIntrested    messageID = 2
	MsgNotIntrested messageID = 3
	MsgHave         messageID = 4
	MsgBitfield     messageID = 5
	MsgRequest      messageID = 6
	MsgPiece        messageID = 7
	MsgCancel       messageID = 8
)

Variables

This section is empty.

Functions

func ParseHave

func ParseHave(msg *Message) (int, error)

func ParsePiece

func ParsePiece(index int, buf []byte, msg *Message) (int, error)

Types

type Message

type Message struct {
	ID      messageID
	Payload []byte
}

func FormatHave

func FormatHave(index int) *Message

func FormatRequest

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

func Read

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

func (*Message) Serialize

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

func (*Message) String

func (m *Message) String() string

Jump to

Keyboard shortcuts

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