proxy

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Codec

func Codec() encoding.Codec

Codec exposes a grpc Codec.

func ServerCodec

func ServerCodec() grpc.Codec

ServerCodec exposes a grpc.Codec that can be used by a grpc.Server.

func UnknownServiceHandler

func UnknownServiceHandler(router *Router) grpc.StreamHandler

UnknownServiceHandler returns a grpc.StreamHandler that uses the provided Router to direct messages to different backends.

Types

type Backend

type Backend struct {
	ClientConn      *grpc.ClientConn
	RegisterService func(server *grpc.Server)
}

Backend defines a backend service to route to.

type Router

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

Router maintains mappings of services and their upstream channels.

func NewRouter

func NewRouter(backends ...*Backend) (*Router, error)

NewRouter constructs a Router using the provided backends. Routing decisions are based on first match.

func (*Router) Route

func (s *Router) Route(fullMethodName string) (*grpc.ClientConn, error)

Route determines which upstream a given request should be sent to.

Jump to

Keyboard shortcuts

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