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

@@ -107,7 +107,7 @@ func (p *Proxy) getRoute(service string) ([]string, error) {
if p.Router != nil {
// lookup the router
routes, err := p.Router.Table().Lookup(
table.NewQuery(table.QueryDestination(service)),
table.NewQuery(table.QueryService(service)),
)
if err != nil {
return nil, err
@@ -180,7 +180,7 @@ func (p *Proxy) getRoute(service string) ([]string, error) {
// call the router
proutes, err := p.RouterService.Lookup(context.Background(), &pb.LookupRequest{
Query: &pb.Query{
Destination: service,
Service: service,
},
}, client.WithAddress(addr))
if err != nil {
@@ -205,11 +205,12 @@ func (p *Proxy) getRoute(service string) ([]string, 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),
})
}