1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-09-16 08:36:30 +02:00

Router selector and proxy modifications due to Route struct changes.

This commit is contained in:
Milos Gajdos
2019-07-09 16:45:31 +01:00
parent 23cb811f60
commit 6cf8bde612
5 changed files with 74 additions and 138 deletions

View File

@@ -45,7 +45,7 @@ func (r *routerSelector) getRoutes(service string) ([]table.Route, error) {
if !r.remote {
// lookup router for routes for the service
return r.r.Table().Lookup(table.NewQuery(
table.QueryDestination(service),
table.QueryService(service),
))
}
@@ -83,7 +83,7 @@ func (r *routerSelector) getRoutes(service string) ([]table.Route, error) {
// call the router
pbRoutes, err = r.rs.Lookup(context.Background(), &pb.LookupRequest{
Query: &pb.Query{
Destination: service,
Service: service,
},
}, client.WithAddress(addr))
if err != nil {
@@ -107,11 +107,12 @@ func (r *routerSelector) getRoutes(service string) ([]table.Route, error) {
// convert from pb to []*router.Route
for _, r := range pbRoutes.Routes {
routes = append(routes, table.Route{
Destination: r.Destination,
Gateway: r.Gateway,
Router: r.Router,
Network: r.Network,
Metric: int(r.Metric),
Service: r.Service,
Address: r.Address,
Gateway: r.Gateway,
Network: r.Network,
Link: r.Link,
Metric: int(r.Metric),
})
}