Changed router interface. Added table watcher. Advertise routes

* Changed router interface to return Advertisement channel
* Added default gateway route to the routing table if supplied
* Watch table for updates and advertise to the network
* We hash the routes on 3-tuple (Destination, Gateway, Network)
This commit is contained in:
Milos Gajdos
2019-06-27 22:52:51 +01:00
parent 0971deb9cc
commit 9d7420658d
6 changed files with 172 additions and 42 deletions

View File

@@ -81,7 +81,7 @@ type tableWatcher struct {
}
// Next returns the next noticed action taken on table
// TODO: this needs to be thought through properly; we only allow watching particular route destination
// TODO: this needs to be thought through properly; we only allow watching particular route destination for now
func (w *tableWatcher) Next() (*Event, error) {
for {
select {
@@ -93,6 +93,7 @@ func (w *tableWatcher) Next() (*Event, error) {
if w.opts.Destination == res.Route.Destination {
return res, nil
}
continue
}
case <-w.done:
return nil, ErrWatcherStopped