middleware

package
v0.0.0-...-585f190 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

var Plugins = map[string]gosdk.GrpcPlugin{
	"jwt": &auth.JWTAuth{},
}

Functions

func NewGrpcPluginStream

func NewGrpcPluginStream(s grpc.ServerStream, fullName string, ctx context.Context, plugin *pluginImpl) *grpcPluginStream

func NewPluginImpl

func NewPluginImpl(lb lb.LoadBalance, name string, timeout time.Duration) *pluginImpl

Types

type Http

type Http struct {
	// contains filtered or unexported fields
}

func NewHttp

func NewHttp() *Http

func (*Http) Name

func (h *Http) Name() string

func (*Http) Priority

func (h *Http) Priority() int

func (*Http) SetPriority

func (h *Http) SetPriority(priority int)

func (*Http) StreamInterceptor

func (h *Http) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*Http) UnaryInterceptor

func (h *Http) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

type HttpStream

type HttpStream struct {
	grpc.ServerStream
	FullMethod string
}
	w.Header().Set("Content-Type", "application/json")
	return nil
}

func (*HttpStream) SendMsg

func (s *HttpStream) SendMsg(m interface{}) error

type ParamsValidator

type ParamsValidator interface {
	gosdk.LocalPlugin
	ValidateParams(v interface{}) error
}

func NewParamsValidator

func NewParamsValidator() ParamsValidator

type ParamsValidatorImpl

type ParamsValidatorImpl struct {
	// contains filtered or unexported fields
}

func (*ParamsValidatorImpl) FiltersFields

func (p *ParamsValidatorImpl) FiltersFields(v interface{}, parent string) []string

FiltersFields 从FieldMask中获取过滤字段,获取待验证字段

func (*ParamsValidatorImpl) Name

func (p *ParamsValidatorImpl) Name() string

func (*ParamsValidatorImpl) Priority

func (p *ParamsValidatorImpl) Priority() int

func (*ParamsValidatorImpl) SetPriority

func (p *ParamsValidatorImpl) SetPriority(priority int)

func (*ParamsValidatorImpl) StreamInterceptor

func (p *ParamsValidatorImpl) StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func (*ParamsValidatorImpl) UnaryInterceptor

func (p *ParamsValidatorImpl) UnaryInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)

func (*ParamsValidatorImpl) ValidateParams

func (p *ParamsValidatorImpl) ValidateParams(v interface{}) error

type PluginsApply

type PluginsApply struct {
	Plugins gosdk.Plugins
}

func New

func New(config *config.Config,
	rdb *tiga.RedisDao,
	user *biz.AuthzUsecase,
	log logger.Logger,
	authz *biz.AccessKeyAuth,
) *PluginsApply

func NewPluginsApply

func NewPluginsApply() *PluginsApply

func (*PluginsApply) Register

func (p *PluginsApply) Register(plugin gosdk.LocalPlugin, priority int)

func (*PluginsApply) StreamInterceptorChains

func (p *PluginsApply) StreamInterceptorChains() []grpc.StreamServerInterceptor

func (*PluginsApply) UnaryInterceptorChains

func (p *PluginsApply) UnaryInterceptorChains() []grpc.UnaryServerInterceptor

type RPCPluginCaller

type RPCPluginCaller interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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