message

package
v0.0.0-...-e00f62a Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ID_STATUS_CHOKED = 0

// // PWP MESSAGE ID TABLE // // Status

View Source
const ID_STATUS_INTERESTED = 2
View Source
const ID_STATUS_NOT_INTERESTED = 3
View Source
const ID_STATUS_UNCHOKED = 1
View Source
const STATUS_TYPE_CHOKED = 0
View Source
const STATUS_TYPE_INTERESTED = 1

Variables

This section is empty.

Functions

func Encode

func Encode(message PWPMessage) []byte

func IsStatusMessage

func IsStatusMessage(id int) bool

Types

type MessageWithBody

type MessageWithBody struct {
	// contains filtered or unexported fields
}

func NewPWPMessageWithBody

func NewPWPMessageWithBody(id int, length int, payload interface{}) *MessageWithBody

func (*MessageWithBody) GetId

func (m *MessageWithBody) GetId() int

func (*MessageWithBody) GetLength

func (m *MessageWithBody) GetLength() int

func (*MessageWithBody) GetPayload

func (m *MessageWithBody) GetPayload() interface{}

func (*MessageWithBody) ToString

func (m *MessageWithBody) ToString() string

type PWPMessage

type PWPMessage interface {
	GetId() int
	GetLength() int
	GetPayload() interface{}
	ToString() string
}

func Decode

func Decode(data []byte) PWPMessage

type Status

type Status struct {
	// contains filtered or unexported fields
}

func GetStatusFromId

func GetStatusFromId(id int) *Status

func NewStatus

func NewStatus(statusType int, statusValue bool) *Status

func (*Status) GetId

func (sm *Status) GetId() int

func (*Status) GetLength

func (sm *Status) GetLength() int

func (*Status) GetPayload

func (sm *Status) GetPayload() interface{}

func (*Status) ToString

func (sm *Status) ToString() string

type StatusTuple

type StatusTuple struct {
	StatusType  int
	StatusValue bool
}

func GetStatusTupleFromId

func GetStatusTupleFromId(id int) *StatusTuple

Jump to

Keyboard shortcuts

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