define

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DisconnectByServer           = "disconnect by server"
	DisconnectByClient           = "disconnect by client"
	DisconnectByKeepAliveTimeOut = "disconnect by keep alive time out"
)
View Source
const (
	CodeRegister  = 1
	CodeHeartBeat = 2
	CodeData      = 3

	CodeRegisterReplay = CodeRegister + 0x80
	CodeDataReplay     = CodeData + 0x80
)

Variables

This section is empty.

Functions

func Encrypt

func Encrypt(data string) (rsp string, err error)

Types

type Agreement

type Agreement struct {
	Code      int    `json:"code"`           //命令码
	Timestamp int64  `json:"timestamp"`      //时间戳
	Data      string `json:"data,omitempty"` //数据 明文经过AES算法加密后的密文

	DiscardedData []byte `json:"-"`
}

func ParseAgreement

func ParseAgreement(data []byte) (rsp Agreement, err error)

type AgreementData

type AgreementData struct {
	Key       string                 `json:"key,omitempty"`     // 关键字
	Payload   map[string]interface{} `json:"payload,omitempty"` //自定义数据
	RandomStr string                 `json:"randomStr"`         //随机字符串
}

func Decrypt

func Decrypt(data string) (rsp AgreementData, err error)

Jump to

Keyboard shortcuts

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