grpcproxy

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package grpcproxy provides a single proxy grpc server which can be used to tranparently forward both unary and bidirectional streams across different gRPC connections. The main use case was to provide connections across auth domains.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMetricViews

func RegisterMetricViews() error

RegisterMetricViews registers all metric views for proxy for Opencensus to actively record.

Types

type DestProviderFn

type DestProviderFn func(metadata.MD, string) (string, metadata.MD, error)

DestProviderFn computes a target address for this reverse proxy for every new proxy request. Implementations can compute an address based on input of incoming request method and headers. Return values should be the next target address and the metadata to pass to the target.

type GRPCDialer

type GRPCDialer interface {
	DialGRPC(context.Context, string, ...grpc.DialOption) (*grpc.ClientConn, error)
}

GRPCDialer is interface to dial a gRPC connection.

type GRPCServer

type GRPCServer interface {
	Serve(net.Listener) error
	Stop()
}

GRPCServer is an interface to server gRPC.

func NewServer

func NewServer(dp DestProviderFn, opts ...Option) (GRPCServer, error)

NewServer returns a GRPCServer proxy that handles unknown services.

type Option

type Option func(p *proxy)

Option configures the proxy server.

func WithDialer

func WithDialer(d GRPCDialer) Option

WithDialer sets the proxy server GRPCDialer implementation.

func WithServerProvider

func WithServerProvider(sp ServerProviderFn) Option

WithServerProvider sets the proxy server GRPCServer provider implementation. REMINDER: if you are providing this option make sure you properly handle the appending of opts from the caller in your implementation as the server will append additional opts as part of it startup. Specifically grpc.ForceServerCodec and grpc.UnknownServiceHandler.

type ServerProviderFn

type ServerProviderFn func(...grpc.ServerOption) (GRPCServer, error)

ServerProviderFn creates a GRPCServer from server options.

Jump to

Keyboard shortcuts

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