go-micro: github.com/micro/go-micro/proxy/mucp Index | Files

package mucp

import "github.com/micro/go-micro/proxy/mucp"

Package mucp transparently forwards the incoming request using a go-micro client.


Package Files


func NewProxy Uses

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

NewProxy returns a new proxy which will route based on mucp headers

type Proxy Uses

type Proxy struct {

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

    // The client to use for outbound requests in the local network
    Client client.Client

    // Links are used for outbound requests not in the local network
    Links map[string]client.Client

    // The router for routes
    Router router.Router

    // A fib of routes service:address
    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 Uses

func NewSingleHostProxy(endpoint string) *Proxy

NewSingleHostProxy returns a proxy which sends requests to a single backend

func (*Proxy) ProcessMessage Uses

func (p *Proxy) ProcessMessage(ctx context.Context, msg server.Message) error

ProcessMessage acts as a message exchange and forwards messages to ongoing topics TODO: should we look at p.Endpoint and only send to the local endpoint? probably

func (*Proxy) ServeRequest Uses

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

ServeRequest honours the server.Router interface

func (*Proxy) String Uses

func (p *Proxy) String() string

Package mucp imports 17 packages (graph) and is imported by 12 packages. Updated 2020-02-22. Refresh now. Tools for package owners.