Update router querying method (#834)
* Add address to router query options. Drop Query interface for QueryOptions * Cleanup isMatch function * Update network proto
This commit is contained in:
@@ -321,13 +321,15 @@ func (s *svc) Stop() error {
|
||||
}
|
||||
|
||||
// Lookup looks up routes in the routing table and returns them
|
||||
func (s *svc) Lookup(q router.Query) ([]router.Route, error) {
|
||||
func (s *svc) Lookup(q ...router.QueryOption) ([]router.Route, error) {
|
||||
// call the router
|
||||
query := router.NewQuery(q...)
|
||||
|
||||
resp, err := s.router.Lookup(context.Background(), &pb.LookupRequest{
|
||||
Query: &pb.Query{
|
||||
Service: q.Options().Service,
|
||||
Gateway: q.Options().Gateway,
|
||||
Network: q.Options().Network,
|
||||
Service: query.Service,
|
||||
Gateway: query.Gateway,
|
||||
Network: query.Network,
|
||||
},
|
||||
}, s.callOpts...)
|
||||
|
||||
|
@@ -90,13 +90,15 @@ func (t *table) List() ([]router.Route, error) {
|
||||
}
|
||||
|
||||
// Lookup looks up routes in the routing table and returns them
|
||||
func (t *table) Query(q router.Query) ([]router.Route, error) {
|
||||
func (t *table) Query(q ...router.QueryOption) ([]router.Route, error) {
|
||||
query := router.NewQuery(q...)
|
||||
|
||||
// call the router
|
||||
resp, err := t.table.Query(context.Background(), &pb.QueryRequest{
|
||||
Query: &pb.Query{
|
||||
Service: q.Options().Service,
|
||||
Gateway: q.Options().Gateway,
|
||||
Network: q.Options().Network,
|
||||
Service: query.Service,
|
||||
Gateway: query.Gateway,
|
||||
Network: query.Network,
|
||||
},
|
||||
}, t.callOpts...)
|
||||
|
||||
|
Reference in New Issue
Block a user