sentinel

package
v0.0.0-...-e12eafd Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultBlockFallback

func DefaultBlockFallback(ctx context.Context, req, resp interface{}, blockErr error) error

func DefaultResourceExtract

func DefaultResourceExtract(ctx context.Context, req, resp interface{}) string

func SentinelClientMiddleware

func SentinelClientMiddleware(opts ...Option) func(endpoint.Endpoint) endpoint.Endpoint

SentinelClientMiddleware returns new client.Middleware Default resource name is {service's name}:{method} Default block fallback is returning blockError Define your own behavior by setting serverOptions

func SentinelServerMiddleware

func SentinelServerMiddleware(opts ...Option) func(endpoint.Endpoint) endpoint.Endpoint

SentinelServerMiddleware returns new server.Middleware Default resource name is {service's name}:{method} Default block fallback is returning blockError Define your own behavior by setting serverOptions

Types

type Option

type Option struct {
	F func(o *options)
}

func WithBlockFallback

func WithBlockFallback(f func(ctx context.Context, req, resp interface{}, blockErr error) error) Option

WithBlockFallback sets the fallback handler

func WithResourceExtract

func WithResourceExtract(f func(ctx context.Context, req, resp interface{}) string) Option

WithResourceExtract sets the resource extractor

Jump to

Keyboard shortcuts

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