Fixup the proxy, strip down go.mod. Win bigly

This commit is contained in:
Asim Aslam
2019-06-07 13:42:39 +01:00
parent d65393a799
commit 9e23855c37
11 changed files with 116 additions and 555 deletions

View File

@@ -4,6 +4,7 @@ package proxy
import (
"context"
"github.com/micro/go-micro/client"
"github.com/micro/go-micro/options"
"github.com/micro/go-micro/server"
)
@@ -11,6 +12,20 @@ import (
// Proxy can be used as a proxy server for go-micro services
type Proxy interface {
options.Options
// ServeRequest will serve a request
// ServeRequest honours the server.Router interface
ServeRequest(context.Context, server.Request, server.Response) error
}
var (
DefaultEndpoint = "localhost:9090"
)
// WithEndpoint sets a proxy endpoint
func WithEndpoint(e string) options.Option {
return options.WithValue("proxy.endpoint", e)
}
// WithClient sets the client
func WithClient(c client.Client) options.Option {
return options.WithValue("proxy.client", c)
}