opcode

package
v0.0.0-...-868bdbc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMessageType

func GetMessageType(code Opcode) (proto.Message, error)

GetMessageType returns the corresponding proto message type given an opcode

func RegisterMessageType

func RegisterMessageType(opcode Opcode, msg proto.Message) error

RegisterMessageType registers a new proto message to the given opcode

Types

type Opcode

type Opcode uint32
const (
	UnregisteredCode       Opcode = 0x00000 // 0
	BytesCode              Opcode = 0x00001 // 1
	PingCode               Opcode = 0x0000a // 10
	PongCode               Opcode = 0x0000b // 11
	LookupNodeRequestCode  Opcode = 0x0000c // 12
	LookupNodeResponseCode Opcode = 0x0000d // 13
)

func GetOpcode

func GetOpcode(msg proto.Message) (Opcode, error)

GetOpcode returns the corresponding opcode given a proto message

Jump to

Keyboard shortcuts

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