Documentation ¶
Index ¶
- Constants
- type BaseContent
- type BizMsg4Recv
- type BizMsg4Send
- type BizMsgCrypt
- func (c *BizMsgCrypt) DecryptMsg(msgSignature, timestamp, nonce string, postData []byte) ([]byte, *Error)
- func (c *BizMsgCrypt) EncryptMsg(replyMsg string) (*BizMsg4Send, *Error)
- func (c *BizMsgCrypt) ParsePlainText(plainText []byte) ([]byte, uint32, []byte, []byte, *Error)
- func (c *BizMsgCrypt) VerifyURL(msgSignature, timestamp, nonce, echoStr string) ([]byte, *Error)
- type Error
- type Msg
- type Processor
- type ProtocolProcessor
- type ProtocolType
Constants ¶
View Source
const ( ValidateSignatureError int = -40001 ParseXmlError int = -40002 ComputeSignatureError int = -40003 IllegalAesKey int = -40004 ValidateReceiveIdError int = -40005 EncryptAESError int = -40006 DecryptAESError int = -40007 IllegalBuffer int = -40008 EncodeBase64Error int = -40009 DecodeBase64Error int = -40010 GenXmlError int = -40011 ParseJsonError int = -40012 GenJsonError int = -40013 IllegalProtocolType int = -40014 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseContent ¶
type BaseContent struct { ReceiveId string `json:"receiveId"` // 公司ID MsgType string `json:"msgType"` // add_customer|edit_customer|add_user|edit_user }
BaseContent 消息基础字段
type BizMsg4Recv ¶
type BizMsg4Recv struct { MsgType string `json:"msgType"` // add_customer|edit_customer|add_user|edit_user Encrypt string `json:"encrypt"` }
BizMsg4Recv 接收消息结构体
type BizMsg4Send ¶
type BizMsg4Send struct { Encrypt string `json:"encrypt"` Signature string `json:"msgSignature"` Timestamp string `json:"timeStamp"` Nonce string `json:"nonce"` }
BizMsg4Send 发送消息结构体
func NewBizMsg4Send ¶
func NewBizMsg4Send(encrypt, signature, timestamp, nonce string) *BizMsg4Send
NewBizMsg4Send 消息发送对象
type BizMsgCrypt ¶
type BizMsgCrypt struct {
// contains filtered or unexported fields
}
func NewBizMsgCrypt ¶
func NewBizMsgCrypt(token, encodingAesKey, receiveId string, protocolType ProtocolType) *BizMsgCrypt
NewBizMsgCrypt 新建加解密对象
func (*BizMsgCrypt) DecryptMsg ¶
func (c *BizMsgCrypt) DecryptMsg(msgSignature, timestamp, nonce string, postData []byte) ([]byte, *Error)
DecryptMsg 消息解密
func (*BizMsgCrypt) EncryptMsg ¶
func (c *BizMsgCrypt) EncryptMsg(replyMsg string) (*BizMsg4Send, *Error)
EncryptMsg 消息加密
func (*BizMsgCrypt) ParsePlainText ¶
type Msg ¶
type Msg struct { BaseContent Content string `json:"content"` // 具体数据字段 (json字符串) CreateTime uint32 `json:"createTime"` // 消息创建时间(整型)单位为秒 }
Msg 消息字段
type ProtocolProcessor ¶
type ProtocolProcessor interface {
// contains filtered or unexported methods
}
ProtocolProcessor 消息处理器
type ProtocolType ¶
type ProtocolType int
const ( XmlType ProtocolType = 1 JsonType ProtocolType = 2 )
Click to show internal directories.
Click to hide internal directories.