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

@@ -20,6 +20,8 @@ type RoutePolicy int
const (
// OverrideIfExists overrides route if it already exists
OverrideIfExists RoutePolicy = iota
// AddIfNotExist adds the route if it does not exist
AddIfNotExists
// IgnoreIfExists instructs to not modify existing route
IgnoreIfExists
)
@@ -28,9 +30,11 @@ const (
func (p RoutePolicy) String() string {
switch p {
case OverrideIfExists:
return "OVERRIDE"
return "OVERRIDE_IF_EXISTS"
case AddIfNotExists:
return "ADD_IF_NOT_EXISTS"
case IgnoreIfExists:
return "IGNORE"
return "IGNORE_IF_EXISTS"
default:
return "UNKNOWN"
}