proto

package
v0.0.0-...-59da782 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposeAddFriendAlert

func ComposeAddFriendAlert(alertType int, operator, name, targetId, targetName, msg string) map[string]interface{}

func ComposeAlert

func ComposeAlert(alertType int, operator, name, msg string) map[string]interface{}

func ComposeCreateRoomMemberAlert

func ComposeCreateRoomMemberAlert(alertType int, operator, name, targetId, targetName, roomId, roomName, msg string) map[string]interface{}

func ComposeDelFriendAlert

func ComposeDelFriendAlert(alertType int, operator, targetId, msg string) map[string]interface{}

func ComposeForwardMsg

func ComposeForwardMsg(channelType int, fromId, fromName, forwardUserName string, data []*types.ChatLog) map[string]interface{}

组合成转发消息

func ComposeHadBurntAlert

func ComposeHadBurntAlert(channelType int, logId string) map[string]interface{}

焚毁消息通知

func ComposeInviteRoomAlert

func ComposeInviteRoomAlert(alertType int, operator, name string, users, names []string, msg string) map[string]interface{}

func ComposeKickOutAlert

func ComposeKickOutAlert(alertType int, operator, targetId, targetName, msg string) map[string]interface{}

func ComposePaymentAlert

func ComposePaymentAlert(operator, logId, recordId string) map[string]interface{}

收款成功消息通知

func ComposePraiseAlert

func ComposePraiseAlert(logId, operator, action string, like, reward int) map[string]interface{}

赞赏通知

func ComposePrintScreen

func ComposePrintScreen(operator string) map[string]interface{}

func ComposeRPReceiveAlert

func ComposeRPReceiveAlert(alertType int, operator, name, owner, ownerName, packetId, msg string) map[string]interface{}

func ComposeRevokeAlert

func ComposeRevokeAlert(logId, operator, name, msg string, level int) map[string]interface{}

撤回消息通知

func ComposeRoomInviteCard

func ComposeRoomInviteCard(roomId, markId, roomName, inviter, avatar, identificationInfo string) map[string]interface{}

func ComposeRoomInviteReject

func ComposeRoomInviteReject(operator, targetId, targetName, msg string) map[string]interface{}

拒绝加入群聊

func ComposeRoomMutedAlert

func ComposeRoomMutedAlert(operator string, mutedType, level, opt int, names []string, msg string) map[string]interface{}

群禁言消息通知

func ComposeSetMemberLevelAlert

func ComposeSetMemberLevelAlert(alertType int, operator, targetId, targetName, msg string) map[string]interface{}

func ComposeSetRoomNameAlert

func ComposeSetRoomNameAlert(alertType int, operator, name, roomName, msg string) map[string]interface{}

func ComposeSingleForwardMsg

func ComposeSingleForwardMsg(channelType int, fromId, fromName string, data *types.ChatLog) map[string]interface{}

func ComposeSystemMsg

func ComposeSystemMsg(msg string) map[string]interface{}

func ComposeUpdateSKeyAlert

func ComposeUpdateSKeyAlert(roomId, fromKey, kid, key string) map[string]interface{}

更新群秘钥消息

func GetProtocolReceiver

func GetProtocolReceiver() map[int]ProtocolReceiver

func NewMsg

func NewMsg(mp map[string]interface{}) msg

func SendAckSuccessNotification

func SendAckSuccessNotification(client *router.Client, begin, end int64)

ack完成通知

func SendAddFriendNotification

func SendAddFriendNotification(userId, logId, reason, source string, source2 interface{}, status int, senderInfo, receiveInfo map[string]interface{})

发送添加好友通知 S->C

func SendApplyNotification

func SendApplyNotification(applyInfo *types.ApplyList, members []string)

发送入群请求和回复通知

func SendBatchSuccessNotification

func SendBatchSuccessNotification(client *router.Client)

同步完成通知

func SendCloseUserAccountNotification

func SendCloseUserAccountNotification(deadline int64, userId, content string)

发送封号通知

func SendClosedRoomNotification

func SendClosedRoomNotification(roomId, content string, deadline int64)

发送封群通知

func SendCreateRoomNotification

func SendCreateRoomNotification(roomId string)

发送建群通知

func SendGetSKeySuccessNotification

func SendGetSKeySuccessNotification(client *router.Client)

群会话秘钥同步完成通知

func SendJoinRoomNotification

func SendJoinRoomNotification(roomId string, members []string)

发送入群通知

func SendLogOutRoomNotification

func SendLogOutRoomNotification(logOutType int, roomId, userId string, content string, members []string)

发送退出群通知

func SendOtherDeviceLogin

func SendOtherDeviceLogin(alertMsg string, client *router.Client)

其他设备登录

func SendRemoveRoomNotification

func SendRemoveRoomNotification(operator, roomId string)

发送解散群通知

func SendRoomMutedNotification

func SendRoomMutedNotification(roomId string, mutedType int, deadline int64, members []string)

发送群中被禁言通知

func SendUpdatePubKeyNotification

func SendUpdatePubKeyNotification(userId, publicKey, privateKey string, users []string)

发送更新用户公钥通知 S->C

Types

type EventAck

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

消息确认机制

func (*EventAck) FromBytes

func (p *EventAck) FromBytes(b []byte) error

func (*EventAck) GetBegin

func (p *EventAck) GetBegin() int64

func (*EventAck) GetEnd

func (p *EventAck) GetEnd() int64

func (*EventAck) GetTotal

func (p *EventAck) GetTotal() int64

func (*EventAck) Receive

func (p *EventAck) Receive(conn router.Connection, msg []byte)

type EventGetSKey

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

同步群会话秘钥

func (*EventGetSKey) FromBytes

func (p *EventGetSKey) FromBytes(b []byte) error

func (*EventGetSKey) GetDatetime

func (p *EventGetSKey) GetDatetime() int64

func (*EventGetSKey) Receive

func (p *EventGetSKey) Receive(conn router.Connection, msg []byte)

type EventSyncMsg

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

开始同步消息

func (*EventSyncMsg) FromBytes

func (p *EventSyncMsg) FromBytes(b []byte) error

func (*EventSyncMsg) GetTime

func (p *EventSyncMsg) GetTime() int64

func (*EventSyncMsg) Receive

func (p *EventSyncMsg) Receive(conn router.Connection, msg []byte)

type EventUpdatePubKey

type EventUpdatePubKey struct {
	PublicKey  string
	PrivateKey string
}

用户更新公钥

func (*EventUpdatePubKey) FromBytes

func (p *EventUpdatePubKey) FromBytes(b []byte) error

func (*EventUpdatePubKey) Receive

func (p *EventUpdatePubKey) Receive(conn router.Connection, msg []byte)

type EventUpdateSKey

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

更新会话秘钥

func (*EventUpdateSKey) FromBytes

func (p *EventUpdateSKey) FromBytes(b []byte) error

func (*EventUpdateSKey) GetFromKey

func (p *EventUpdateSKey) GetFromKey() string

func (*EventUpdateSKey) GetRoomId

func (p *EventUpdateSKey) GetRoomId() string

func (*EventUpdateSKey) GetSecret

func (p *EventUpdateSKey) GetSecret() []secretInfo

func (*EventUpdateSKey) Receive

func (p *EventUpdateSKey) Receive(conn router.Connection, msg []byte)

type IBaseProto

type IBaseProto interface {
	Receive(router.Connection, []byte)
}

func CreateProto

func CreateProto(b []byte) (IBaseProto, error)

type JoinRoomNotification

type JoinRoomNotification struct {
	EventType int    `json:"eventType"`
	RoomId    string `json:"roomId"`
	Datetime  int64  `json:"datetime"`
}

被拉入群通知

type LogOutRoomNotification

type LogOutRoomNotification struct {
	EventType int    `json:"eventType"`
	RoomId    string `json:"roomId"`
	UserId    string `json:"userId"`
	Type      int    `json:"type"`
	Content   string `json:"content"`
}

退群通知

type Proto

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

客户端发送的消息结构

func NewCmnProto

func NewCmnProto(logId, msgId, targetId string, chType, msgType, isSnap int, msg map[string]interface{}, sendTime int64, praise interface{}) (*Proto, error)

普通消息

func (*Proto) AppendChatLog

func (p *Proto) AppendChatLog(userId string, state int, time int64) error

TODO

func (*Proto) FromBytes

func (p *Proto) FromBytes(b []byte) error

func (*Proto) GetChannelType

func (p *Proto) GetChannelType() int

func (*Proto) GetEvType

func (p *Proto) GetEvType() int

func (*Proto) GetExt

func (p *Proto) GetExt() interface{}

func (*Proto) GetGTMsg

func (p *Proto) GetGTMsg(fromId string) string

TODO

func (*Proto) GetIsSnap

func (p *Proto) GetIsSnap() int

func (*Proto) GetLogId

func (p *Proto) GetLogId() string

func (*Proto) GetMsg

func (p *Proto) GetMsg() map[string]interface{}

func (*Proto) GetMsgId

func (p *Proto) GetMsgId() string

func (*Proto) GetMsgType

func (p *Proto) GetMsgType() int

func (*Proto) GetPraise

func (p *Proto) GetPraise() interface{}

func (*Proto) GetRouter

func (p *Proto) GetRouter() string

func (*Proto) GetSendTime

func (p *Proto) GetSendTime() int64

func (*Proto) GetTargetId

func (p *Proto) GetTargetId() string

func (*Proto) IsEncryptedMsg

func (p *Proto) IsEncryptedMsg() bool

func (*Proto) IsSpecial

func (p *Proto) IsSpecial() bool

func (*Proto) Receive

func (p *Proto) Receive(conn router.Connection, msg []byte)

func (*Proto) SetLogId

func (p *Proto) SetLogId(logId string)

func (*Proto) SetTargetId

func (p *Proto) SetTargetId(targetId string)

func (*Proto) WrapResp

func (p *Proto) WrapResp(user *types.User, sendTime int64) ([]byte, error)

type ProtocolCreator

type ProtocolCreator func() IBaseProto

type ProtocolReceiver

type ProtocolReceiver func(IBaseProto, router.Connection, []byte)

type RemoveClosedNotification

type RemoveClosedNotification struct {
	EventType       int    `json:"eventType"`
	RoomId          string `json:"roomId"`
	Content         string `json:"content"`
	DisableDeadline int64  `json:"disableDeadline"`
	Datetime        int64  `json:"datetime"`
}

被封禁群通知

type RemoveRoomNotification

type RemoveRoomNotification struct {
	EventType int    `json:"eventType"`
	RoomId    string `json:"roomId"`
	UserId    string `json:"userId"`
	Datetime  int64  `json:"datetime"`
}

被解散群通知

type RoomMutedNotification

type RoomMutedNotification struct {
	EventType int    `json:"eventType"`
	RoomId    string `json:"roomId"`
	Type      int    `json:"type"`
	Deadline  int64  `json:"deadline"`
}

群禁言通知

type RoomOnlineNumberNotification

type RoomOnlineNumberNotification struct {
	EventType int    `json:"eventType"`
	RoomId    string `json:"roomId"`
	Number    string `json:"number"`
	Datetime  int64  `json:"datetime"`
}

群在线人数通知

Jump to

Keyboard shortcuts

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