processor

package
v0.0.0-...-ff803ae Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MsgTypeSize = 2
View Source
const RawMsgTypeSize = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectHandler

type ConnectHandler func(clientId uint64)

type ConnectJsonHandler

type ConnectJsonHandler func(clientId uint64)

type IProcessor

type IProcessor interface {
	// must goroutine safe
	MsgRoute(msg interface{}, userData interface{}) error
	//must goroutine safe
	UnknownMsgRoute(msg interface{}, userData interface{})
	// connect event
	ConnectedRoute(userData interface{})
	DisConnectedRoute(userData interface{})

	// must goroutine safe
	Unmarshal(data []byte) (interface{}, error)
	// must goroutine safe
	Marshal(msg interface{}) ([]byte, error)
}

type IRawProcessor

type IRawProcessor interface {
	SetByteOrder(littleEndian bool)
	MsgRoute(msg interface{}, userdata interface{}) error
	Unmarshal(data []byte) (interface{}, error)
	Marshal(msg interface{}) ([]byte, error)

	SetRawMsgHandler(handle RawMessageHandler)
	MakeRawMsg(msgType uint16, msg []byte) *PBRawPackInfo
	UnknownMsgRoute(msg interface{}, userData interface{})
	ConnectedRoute(userData interface{})
	DisConnectedRoute(userData interface{})

	SetUnknownMsgHandler(unknownMessageHandler UnknownRawMessageHandler)
	SetConnectedHandler(connectHandler RawConnectHandler)
	SetDisConnectedHandler(disconnectHandler RawConnectHandler)
}

type JsonPackInfo

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

func (*JsonPackInfo) GetMsg

func (slf *JsonPackInfo) GetMsg() interface{}

func (*JsonPackInfo) GetPackType

func (slf *JsonPackInfo) GetPackType() uint16

type JsonProcessor

type JsonProcessor struct {
	LittleEndian bool
	// contains filtered or unexported fields
}

func NewJsonProcessor

func NewJsonProcessor() *JsonProcessor

func (*JsonProcessor) ConnectedRoute

func (jsonProcessor *JsonProcessor) ConnectedRoute(userData interface{})

func (*JsonProcessor) DisConnectedRoute

func (jsonProcessor *JsonProcessor) DisConnectedRoute(userData interface{})

func (*JsonProcessor) MakeMsg

func (jsonProcessor *JsonProcessor) MakeMsg(msgType uint16, msg interface{}) *JsonPackInfo

func (*JsonProcessor) MakeRawMsg

func (jsonProcessor *JsonProcessor) MakeRawMsg(msgType uint16, msg []byte) *JsonPackInfo

func (*JsonProcessor) Marshal

func (jsonProcessor *JsonProcessor) Marshal(msg interface{}) ([]byte, error)

func (*JsonProcessor) MsgRoute

func (jsonProcessor *JsonProcessor) MsgRoute(msg interface{}, userdata interface{}) error

must goroutine safe

func (*JsonProcessor) Register

func (jsonProcessor *JsonProcessor) Register(msgtype uint16, msg interface{}, handle MessageJsonHandler)

func (*JsonProcessor) RegisterConnected

func (jsonProcessor *JsonProcessor) RegisterConnected(connectHandler ConnectJsonHandler)

func (*JsonProcessor) RegisterDisConnected

func (jsonProcessor *JsonProcessor) RegisterDisConnected(disconnectHandler ConnectJsonHandler)

func (*JsonProcessor) RegisterUnknownMsg

func (jsonProcessor *JsonProcessor) RegisterUnknownMsg(unknownMessageHandler UnknownMessageJsonHandler)

func (*JsonProcessor) SetByteOrder

func (jsonProcessor *JsonProcessor) SetByteOrder(littleEndian bool)

func (*JsonProcessor) UnknownMsgRoute

func (jsonProcessor *JsonProcessor) UnknownMsgRoute(msg interface{}, userData interface{})

func (*JsonProcessor) Unmarshal

func (jsonProcessor *JsonProcessor) Unmarshal(data []byte) (interface{}, error)

type MessageHandler

type MessageHandler func(clientId uint64, msg proto.Message)

type MessageInfo

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

type MessageJsonHandler

type MessageJsonHandler func(clientId uint64, msg interface{})

type MessageJsonInfo

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

type PBPackInfo

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

func (*PBPackInfo) GetMsg

func (slf *PBPackInfo) GetMsg() proto.Message

func (*PBPackInfo) GetPackType

func (slf *PBPackInfo) GetPackType() uint16

type PBProcessor

type PBProcessor struct {
	LittleEndian bool
	// contains filtered or unexported fields
}

func NewPBProcessor

func NewPBProcessor() *PBProcessor

func (*PBProcessor) ConnectedRoute

func (pbProcessor *PBProcessor) ConnectedRoute(userData interface{})

connect event

func (*PBProcessor) DisConnectedRoute

func (pbProcessor *PBProcessor) DisConnectedRoute(userData interface{})

func (*PBProcessor) MakeMsg

func (pbProcessor *PBProcessor) MakeMsg(msgType uint16, protoMsg proto.Message) *PBPackInfo

func (*PBProcessor) MakeRawMsg

func (pbProcessor *PBProcessor) MakeRawMsg(msgType uint16, msg []byte) *PBPackInfo

func (*PBProcessor) Marshal

func (pbProcessor *PBProcessor) Marshal(msg interface{}) ([]byte, error)

must goroutine safe

func (*PBProcessor) MsgRoute

func (pbProcessor *PBProcessor) MsgRoute(msg interface{}, userdata interface{}) error

must goroutine safe

func (*PBProcessor) Register

func (pbProcessor *PBProcessor) Register(msgtype uint16, msg proto.Message, handle MessageHandler)

func (*PBProcessor) RegisterConnected

func (pbProcessor *PBProcessor) RegisterConnected(connectHandler ConnectHandler)

func (*PBProcessor) RegisterDisConnected

func (pbProcessor *PBProcessor) RegisterDisConnected(disconnectHandler ConnectHandler)

func (*PBProcessor) RegisterUnknownMsg

func (pbProcessor *PBProcessor) RegisterUnknownMsg(unknownMessageHandler UnknownMessageHandler)

func (*PBProcessor) SetByteOrder

func (pbProcessor *PBProcessor) SetByteOrder(littleEndian bool)

func (*PBProcessor) UnknownMsgRoute

func (pbProcessor *PBProcessor) UnknownMsgRoute(msg interface{}, userData interface{})

func (*PBProcessor) Unmarshal

func (pbProcessor *PBProcessor) Unmarshal(data []byte) (interface{}, error)

must goroutine safe

type PBRawPackInfo

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

func (*PBRawPackInfo) GetMsg

func (slf *PBRawPackInfo) GetMsg() []byte

func (*PBRawPackInfo) GetPackType

func (slf *PBRawPackInfo) GetPackType() uint16

type PBRawProcessor

type PBRawProcessor struct {
	LittleEndian bool
	// contains filtered or unexported fields
}

func NewPBRawProcessor

func NewPBRawProcessor() *PBRawProcessor

func (*PBRawProcessor) ConnectedRoute

func (pbRawProcessor *PBRawProcessor) ConnectedRoute(userData interface{})

connect event

func (*PBRawProcessor) DisConnectedRoute

func (pbRawProcessor *PBRawProcessor) DisConnectedRoute(userData interface{})

func (*PBRawProcessor) MakeRawMsg

func (pbRawProcessor *PBRawProcessor) MakeRawMsg(msgType uint16, msg []byte) *PBRawPackInfo

func (*PBRawProcessor) Marshal

func (pbRawProcessor *PBRawProcessor) Marshal(msg interface{}) ([]byte, error)

must goroutine safe

func (*PBRawProcessor) MsgRoute

func (pbRawProcessor *PBRawProcessor) MsgRoute(msg interface{}, userdata interface{}) error

must goroutine safe

func (*PBRawProcessor) SetByteOrder

func (pbRawProcessor *PBRawProcessor) SetByteOrder(littleEndian bool)

func (*PBRawProcessor) SetConnectedHandler

func (pbRawProcessor *PBRawProcessor) SetConnectedHandler(connectHandler RawConnectHandler)

func (*PBRawProcessor) SetDisConnectedHandler

func (pbRawProcessor *PBRawProcessor) SetDisConnectedHandler(disconnectHandler RawConnectHandler)

func (*PBRawProcessor) SetRawMsgHandler

func (pbRawProcessor *PBRawProcessor) SetRawMsgHandler(handle RawMessageHandler)

func (*PBRawProcessor) SetUnknownMsgHandler

func (pbRawProcessor *PBRawProcessor) SetUnknownMsgHandler(unknownMessageHandler UnknownRawMessageHandler)

func (*PBRawProcessor) UnknownMsgRoute

func (pbRawProcessor *PBRawProcessor) UnknownMsgRoute(msg interface{}, userData interface{})

func (*PBRawProcessor) Unmarshal

func (pbRawProcessor *PBRawProcessor) Unmarshal(data []byte) (interface{}, error)

must goroutine safe

type RawConnectHandler

type RawConnectHandler func(clientId uint64)

type RawMessageHandler

type RawMessageHandler func(clientId uint64, packType uint16, msg []byte)

type RawMessageInfo

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

type UnknownMessageHandler

type UnknownMessageHandler func(clientId uint64, msg []byte)

type UnknownMessageJsonHandler

type UnknownMessageJsonHandler func(clientId uint64, msg []byte)

type UnknownRawMessageHandler

type UnknownRawMessageHandler func(clientId uint64, msg []byte)

Jump to

Keyboard shortcuts

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