securebody

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

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 EnforceSecure

func EnforceSecure(output message.Message)

EnforceSecure 强制加密

func NewSecureBodyPlugin

func NewSecureBodyPlugin(cipherKey string, statCode ...int32) drpc.Plugin

NewSecureBodyPlugin 创建插件 cipherKey: 加密key statCode: 自定义错误码

func WithReplySecureMeta

func WithReplySecureMeta(secure bool) message.MsgSetting

WithReplySecureMeta 要求服务端回复消息的时候加密

func WithSecureMeta

func WithSecureMeta() message.MsgSetting

WithSecureMeta 强制要求传输加密

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) Descriptor() ([]byte, []int)

Deprecated: Use Encrypt.ProtoReflect.Descriptor instead.

func (*Encrypt) GetCipherVersion

func (x *Encrypt) GetCipherVersion() string

func (*Encrypt) GetCiphertext

func (x *Encrypt) GetCiphertext() string

func (*Encrypt) ProtoMessage

func (*Encrypt) ProtoMessage()

func (*Encrypt) ProtoReflect

func (x *Encrypt) ProtoReflect() protoreflect.Message

func (*Encrypt) Reset

func (x *Encrypt) Reset()

func (*Encrypt) String

func (x *Encrypt) String() string

Jump to

Keyboard shortcuts

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