Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SecureMetaKey 所有消息体都需要加密 SecureMetaKey = "X-Secure-Body" // ReplySecureMetaKey 发送的消息不需要加密,回复的消息需要加密 ReplySecureMetaKey = "X-Reply-Secure-Body" // RawBody 原始的消息结构体对象,使用该插件以后,传输层的消息结构体是Encrypt,但是用户使用的是业务层定义的对象,需要保存该对象,方便解码后给到用户层 RawBody = "secure_body_raw_body" )
Variables ¶
View Source
var File_secureBody_proto protoreflect.FileDescriptor
Functions ¶
func NewSecureBodyPlugin ¶
NewSecureBodyPlugin 创建插件 cipherKey: 加密key statCode: 自定义错误码
func WithReplySecureMeta ¶
func WithReplySecureMeta(secure bool) message.MsgSetting
WithReplySecureMeta 要求服务端回复消息的时候加密
Types ¶
type Encrypt ¶
type Encrypt struct { CipherVersion string `protobuf:"bytes,1,opt,name=cipherVersion,proto3" json:"cipherVersion,omitempty"` Ciphertext string `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` // contains filtered or unexported fields }
func (*Encrypt) Descriptor
deprecated
func (*Encrypt) GetCipherVersion ¶
func (*Encrypt) GetCiphertext ¶
func (*Encrypt) ProtoMessage ¶
func (*Encrypt) ProtoMessage()
func (*Encrypt) ProtoReflect ¶
func (x *Encrypt) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.