grpc

package
Version: v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 10 Imported by: 7

Documentation

Overview

Package grpc transparently forwards the grpc protocol using a go-micro client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProxy

func NewProxy(opts ...options.Option) proxy.Proxy

NewProxy returns a new grpc proxy server

Types

type Proxy

type Proxy struct {
	// The proxy options
	options.Options

	// Endpoint specified the fixed endpoint to call.
	Endpoint string

	// The client to use for outbound requests
	Client client.Client
}

Proxy will transparently proxy requests to the backend. If no backend is specified it will call a service using the client. If the service matches the Name it will use the server.DefaultRouter.

func NewSingleHostProxy

func NewSingleHostProxy(url string) *Proxy

NewSingleHostProxy returns a router which sends requests to a single backend

func (*Proxy) SendRequest added in v1.10.0

func (p *Proxy) SendRequest(ctx context.Context, req client.Request, rsp client.Response) error

func (*Proxy) ServeRequest

func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server.Response) error

ServeRequest honours the server.Proxy interface

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL