director

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package director provides proxy call routing facility

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalAddressProvider

type LocalAddressProvider interface {
	IsLocalTarget(string) bool
}

LocalAddressProvider provides local address information.

func NewLocalAddressProvider

func NewLocalAddressProvider(st state.State) (LocalAddressProvider, error)

NewLocalAddressProvider initializes and returns a new LocalAddressProvider.

type RemoteBackendFactory

type RemoteBackendFactory func(target string) (proxy.Backend, error)

RemoteBackendFactory provides backend generation by address (target).

type Router

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

Router wraps grpc-proxy StreamDirector.

func NewRouter

func NewRouter(backendFactory RemoteBackendFactory, localBackend proxy.Backend, localAddressProvider LocalAddressProvider) *Router

NewRouter builds new Router.

func (*Router) Director

func (r *Router) Director(ctx context.Context, fullMethodName string) (proxy.Mode, []proxy.Backend, error)

Director implements proxy.StreamDirector function.

func (*Router) Register

func (r *Router) Register(srv *grpc.Server)

Register is no-op to implement factory.Registrator interface.

Actual proxy handler is installed via grpc.UnknownServiceHandler option.

func (*Router) RegisterStreamedRegex

func (r *Router) RegisterStreamedRegex(regex string)

RegisterStreamedRegex register regex for streamed method.

This could be exact literal match: /^\/serviceName\/methodName$/ or any suffix/prefix match.

func (*Router) StreamedDetector

func (r *Router) StreamedDetector(fullMethodName string) bool

StreamedDetector implements proxy.StreamedDetector.

Jump to

Keyboard shortcuts

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