mucp

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package mucp transparently forwards the incoming request 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 proxy which will route based on mucp headers

Types

type Proxy

type Proxy struct {
	// embed options
	options.Options

	// Endpoint specifies the fixed service endpoint to call.
	Endpoint string

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

	// The router for routes
	Router router.Router

	// A fib of routes service:address
	sync.RWMutex
	Routes map[string]map[uint64]router.Route
	// contains filtered or unexported fields
}

Proxy will transparently proxy requests to an endpoint. If no endpoint is specified it will call a service using the client.

func NewSingleHostProxy

func NewSingleHostProxy(endpoint string) *Proxy

NewSingleHostProxy returns a proxy which sends requests to a single backend

func (*Proxy) ServeRequest

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

ServeRequest honours the server.Router interface

Jump to

Keyboard shortcuts

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