grpcproxy

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kind is the kind of Fallback.
	Kind = constant.HTTPGrpcProxyFilter

	// DescriptorSourceKey current ds
	DescriptorSourceKey = "DescriptorSource"

	// GrpcClientConnKey the grpc-client-conn by the coroutine local
	GrpcClientConnKey = "GrpcClientConn"
)
View Source
const (
	NONE   = "none"
	AUTO   = "auto"
	LOCAL  = "local"
	REMOTE = "remote"
)

Variables

View Source
var ErrReflectionNotSupported = errors.New("server does not support the reflection API")

Functions

func DescriptorSourceFromFileDescriptors

func DescriptorSourceFromFileDescriptors(files ...*desc.FileDescriptor) (*fileSource, error)

func Invoke

func Invoke(ctx context.Context, stub grpcdynamic.Stub, mthDesc *desc.MethodDescriptor, grpcReq proto.Message, opts ...grpc.CallOption) (proto.Message, error)

func RegisterExtension

func RegisterExtension(source DescriptorSource, extReg *dynamic.ExtensionRegistry, msgDesc *desc.MessageDescriptor, registered map[string]bool) error

Types

type Config

type Config struct {
	DescriptorSourceStrategy DescriptorSourceStrategy `yaml:"descriptor_source_strategy" json:"descriptor_source_strategy" default:"auto"`
	Path                     string                   `yaml:"path" json:"path"`
	Rules                    []*Rule                  `yaml:"rules" json:"rules"`     //nolint
	Timeout                  time.Duration            `yaml:"timeout" json:"timeout"` //nolint
}

Config describe the config of AccessFilter

type Descriptor

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

func (*Descriptor) GetCurrentDescriptorSource

func (dr *Descriptor) GetCurrentDescriptorSource(ctx context.Context) (DescriptorSource, error)

type DescriptorSource

type DescriptorSource interface {
	// ListServices returns a list of fully-qualified service names. It will be all services in a set of
	// descriptor files or the set of all services exposed by a gRPC server.
	ListServices() ([]string, error)
	// FindSymbol returns a descriptor for the given fully-qualified symbol name.
	FindSymbol(fullyQualifiedName string) (desc.Descriptor, error)
	// AllExtensionsForType returns all known extension fields that extend the given message type name.
	AllExtensionsForType(typeName string) ([]*desc.FieldDescriptor, error)
}

type DescriptorSourceStrategy

type DescriptorSourceStrategy string

func (DescriptorSourceStrategy) String

func (c DescriptorSourceStrategy) String() string

func (DescriptorSourceStrategy) Val

type Filter

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

func (*Filter) Decode

func (f *Filter) Decode(c *http.HttpContext) filter.FilterStatus

Decode use the default http to grpc transcoding strategy https://cloud.google.com/endpoints/docs/grpc/transcoding

type FilterFactory

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

FilterFactory is grpc filter instance

func (*FilterFactory) Apply

func (factory *FilterFactory) Apply() error

func (*FilterFactory) Config

func (factory *FilterFactory) Config() interface{}

func (*FilterFactory) PrepareFilterChain

func (factory *FilterFactory) PrepareFilterChain(ctx *http.HttpContext, chain filter.FilterChain) error

type Match

type Match struct {
	Method string `yaml:"method" json:"method"` //nolint
}

type Plugin

type Plugin struct {
}

Plugin is grpc filter plugin.

func (*Plugin) CreateFilterFactory

func (p *Plugin) CreateFilterFactory() (filter.HttpFilterFactory, error)

func (*Plugin) Kind

func (p *Plugin) Kind() string

type Rule

type Rule struct {
	Selector string `yaml:"selector" json:"selector"`
	Match    Match  `yaml:"match" json:"match"`
}

Jump to

Keyboard shortcuts

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