2019-06-21 16:17:12 +01:00
|
|
|
// Package router provides a network routing control plane
|
2019-06-06 16:37:40 +01:00
|
|
|
package router
|
|
|
|
|
2019-06-21 16:17:12 +01:00
|
|
|
// Router is an interface for a routing control plane
|
2019-06-06 16:37:40 +01:00
|
|
|
type Router interface {
|
2019-06-12 22:30:42 +01:00
|
|
|
// Init initializes the router with options
|
2019-06-06 16:37:40 +01:00
|
|
|
Init(...Option) error
|
2019-06-12 22:30:42 +01:00
|
|
|
// Options returns the router options
|
2019-06-06 16:37:40 +01:00
|
|
|
Options() Options
|
2019-06-20 13:04:58 +01:00
|
|
|
// ID returns the id of the router
|
2019-06-16 23:09:59 +01:00
|
|
|
ID() string
|
2019-06-20 13:04:58 +01:00
|
|
|
// Table returns the routing table
|
2019-06-07 13:29:09 +01:00
|
|
|
Table() Table
|
2019-06-13 12:09:49 +01:00
|
|
|
// Address returns the router adddress
|
2019-06-06 23:29:24 +01:00
|
|
|
Address() string
|
2019-06-20 13:04:58 +01:00
|
|
|
// Network returns the network address of the router
|
2019-06-07 17:20:22 +01:00
|
|
|
Network() string
|
2019-06-20 13:04:58 +01:00
|
|
|
// Advertise starts advertising the routes to the network
|
|
|
|
Advertise() error
|
2019-06-12 22:30:42 +01:00
|
|
|
// Stop stops the router
|
2019-06-11 23:59:25 +01:00
|
|
|
Stop() error
|
2019-06-07 13:29:09 +01:00
|
|
|
// String returns debug info
|
|
|
|
String() string
|
|
|
|
}
|
|
|
|
|
2019-06-09 23:09:38 +01:00
|
|
|
// Option used by the router
|
2019-06-06 16:37:40 +01:00
|
|
|
type Option func(*Options)
|
|
|
|
|
|
|
|
// NewRouter creates new Router and returns it
|
|
|
|
func NewRouter(opts ...Option) Router {
|
|
|
|
return newRouter(opts...)
|
|
|
|
}
|