grpc_context

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FilterSkillName = config.TypeNameOf((*GrpcFilter)(nil))
)

Functions

func DoGrpcFilter

func DoGrpcFilter(filter GrpcFilter, ctx eocontext.EoContext, next eocontext.IChain) (err error)

Types

type GrpcFilter

type GrpcFilter interface {
	DoGrpcFilter(ctx IGrpcContext, next eocontext.IChain) (err error)
}

type IGrpcContext

type IGrpcContext interface {
	eocontext.EoContext

	// Request 获取原始请求
	Request() IRequest
	// Proxy 获取待转发请求
	Proxy() IRequest
	// Response 获取服务端响应内容
	Response() IResponse

	// EnableTls 是否开启tls认证
	EnableTls(bool)
	// InsecureCertificateVerify 是否跳过证书检查
	InsecureCertificateVerify(bool)
	// Invoke grpc调用
	Invoke(node eocontext.INode, timeout time.Duration) error
	FastFinish() error
}

func Assert

func Assert(ctx eocontext.EoContext) (IGrpcContext, error)

type IHeader

type IHeader interface {
	IHeaderReader
	IHeaderWriter
}

type IHeaderReader

type IHeaderReader interface {
	Get(key string) string
	Headers()
}

type IHeaderWriter

type IHeaderWriter interface {
	Set(key string, value string)
}

type IMessageDescriptor added in v0.10.1

type IMessageDescriptor interface {
}

type IRequest

type IRequest interface {
	Headers() metadata.MD
	Host() string
	SetHost(string)
	Service() string
	SetService(string)
	Method() string
	SetMethod(string)
	FullMethodName() string
	RealIP() string
	ForwardIP() string
	// Message 获取原始请求内容,在grpc协议需要转其他协议时使用
	Message(*desc.MessageDescriptor) *dynamic.Message
}

type IResponse

type IResponse interface {
	Headers() metadata.MD
	Message() *dynamic.Message
	Trailer() metadata.MD
	Write(msg *dynamic.Message)
	SetErr(err error)
	Error() error
}

type ITrailer

type ITrailer interface {
	IHeaderReader
	IHeaderWriter
}

Jump to

Keyboard shortcuts

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