photon_spectator

package module
v0.0.0-...-713aea0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 5 Imported by: 1

README

Photon Observer

Build Status GoDoc

Tools for working with the Photon protocol via gopacket.

Documentation

Index

Constants

View Source
const (
	NilType               = 42
	DictionaryType        = 68
	StringSliceType       = 97
	Int8Type              = 98
	Custom                = 99
	DoubleType            = 100
	EventDateType         = 101
	Float32Type           = 102
	Hashtable             = 104
	Int32Type             = 105
	Int16Type             = 107
	Int64Type             = 108
	Int32SliceType        = 110
	BooleanType           = 111
	OperationResponseType = 112
	OperationRequestType  = 113
	StringType            = 115
	Int8SliceType         = 120
	SliceType             = 121
	ObjectSliceType       = 122
)
View Source
const (
	// Command types
	AcknowledgeType          = 1
	ConnectType              = 2
	VerifyConnectType        = 3
	DisconnectType           = 4
	PingType                 = 5
	SendReliableType         = 6
	SendUnreliableType       = 7
	SendReliableFragmentType = 8
	// Message types
	OperationRequest = 2

	EventDataType     = 4
	OperationResponse = 7
)
View Source
const (
	PhotonCommandHeaderLength = 12
)

Variables

View Source
var PhotonLayerType = gopacket.RegisterLayerType(5056,
	gopacket.LayerTypeMetadata{
		Name:    "PhotonLayerType",
		Decoder: gopacket.DecodeFunc(decodePhotonPacket)})

Functions

This section is empty.

Types

type FragmentBuffer

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

Provides a LRU backed buffer which will assemble ReliableFragments into a single PhotonCommand with type ReliableMessage

func NewFragmentBuffer

func NewFragmentBuffer() *FragmentBuffer

Makes a new instance of a FragmentBuffer

func (*FragmentBuffer) Offer

Offers a message to the buffer. Returns nil when no new commands could be assembled from the buffer's contents.

type PhotonCommand

type PhotonCommand struct {
	// Header
	Type                   uint8
	ChannelID              uint8
	Flags                  uint8
	ReservedByte           uint8
	Length                 int32
	ReliableSequenceNumber int32

	// Body
	Data []byte
}

func (PhotonCommand) ReliableFragment

func (c PhotonCommand) ReliableFragment() (msg ReliableFragment, err error)

Returns a structure containing the fields of a reliable fragment Errors if the type is not SendReliableFragmentType.

func (PhotonCommand) ReliableMessage

func (c PhotonCommand) ReliableMessage() (msg ReliableMessage, err error)

Returns a structure containing the fields of a reliable message. Errors if the type is not SendReliableType.

type PhotonLayer

type PhotonLayer struct {
	// Header
	PeerID       uint16
	CrcEnabled   uint8
	CommandCount uint8
	Timestamp    uint32
	Challenge    int32

	// Commands
	Commands []PhotonCommand
	// contains filtered or unexported fields
}

func (PhotonLayer) LayerContents

func (p PhotonLayer) LayerContents() []byte

func (PhotonLayer) LayerPayload

func (p PhotonLayer) LayerPayload() []byte

func (PhotonLayer) LayerType

func (p PhotonLayer) LayerType() gopacket.LayerType

type ReliableFragment

type ReliableFragment struct {
	SequenceNumber int32
	FragmentCount  int32
	FragmentNumber int32
	TotalLength    int32
	FragmentOffset int32

	Data []byte
}

type ReliableMessage

type ReliableMessage struct {
	// Header
	Signature uint8
	Type      uint8

	// OperationRequest
	OperationCode uint8

	// EventData
	EventCode uint8

	// OperationResponse
	OperationResponseCode uint16
	OperationDebugString  string

	ParamaterCount int16
	Data           []byte
}

type ReliableMessageParamaters

type ReliableMessageParamaters map[uint8]interface{}

func DecodeReliableMessage

func DecodeReliableMessage(msg ReliableMessage) ReliableMessageParamaters

Converts the parameters of a reliable message into a hash suitable for use in hashmap.

Jump to

Keyboard shortcuts

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