From 2cc18d6edc4d1d57b8005a6ca14a33fe31652a6b Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 6 Jun 2019 17:58:21 +0100 Subject: [PATCH] fix errors --- proxy/grpc/grpc.go | 14 +++++++------- proxy/grpc/options.go | 4 ++-- proxy/proxy.go | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/proxy/grpc/grpc.go b/proxy/grpc/grpc.go index 77cf6457..67cf5b10 100644 --- a/proxy/grpc/grpc.go +++ b/proxy/grpc/grpc.go @@ -10,14 +10,14 @@ import ( "github.com/micro/go-micro/client" "github.com/micro/go-micro/codec" "github.com/micro/go-micro/codec/bytes" - "github.com/micro/go-micro/init" + "github.com/micro/go-micro/options" "github.com/micro/go-micro/server" "github.com/micro/go-micro/service/grpc" ) // 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.DefaultProxy. +// If the service matches the Name it will use the server.DefaultRouter. type Proxy struct { // Name of the local service. In the event it's to be left alone Name string @@ -36,7 +36,7 @@ type Proxy struct { Client client.Client // The proxy options - Options init.Options + Options options.Options } var ( @@ -94,7 +94,7 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server // check service route if req.Service() == p.Name { // use the default router - return server.DefaultProxy.ServeRequest(ctx, req, rsp) + return server.DefaultRouter.ServeRequest(ctx, req, rsp) } opts := []client.CallOption{} @@ -170,9 +170,9 @@ func (p *Proxy) ServeRequest(ctx context.Context, req server.Request, rsp server } // NewProxy returns a new grpc proxy server -func NewProxy(opts ...init.Option) *Proxy { +func NewProxy(opts ...options.Option) *Proxy { return &Proxy{ - Options: init.NewOptions(opts...), + Options: options.NewOptions(opts...), } } @@ -233,7 +233,7 @@ func NewService(opts ...micro.Option) micro.Service { // prepend router to opts opts = append([]micro.Option{ micro.Name(name), - WithProxy(router), + WithRouter(router), }, opts...) // create the new service diff --git a/proxy/grpc/options.go b/proxy/grpc/options.go index 7ead4364..a2d8e2a4 100644 --- a/proxy/grpc/options.go +++ b/proxy/grpc/options.go @@ -13,12 +13,12 @@ func WithBackend(url string) micro.Option { // not set if r == nil { - r = DefaultRouter + r = DefaultProxy o.Server.Init(server.WithRouter(r)) } // check its a proxy router - if proxyRouter, ok := r.(*Router); ok { + if proxyRouter, ok := r.(*Proxy); ok { proxyRouter.Backend = url } } diff --git a/proxy/proxy.go b/proxy/proxy.go index a99041ba..03c67daf 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -12,7 +12,7 @@ import ( type Proxy interface { options.Options // ServeRequest will serve a request - ServeRequest(context.Context, Request, Response) error + ServeRequest(context.Context, server.Request, server.Response) error // run the proxy Run() error }