Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct { Routes map[string]*Route // minimum interval between changing states MinFlapInterval time.Duration // delay between interface up and announcing it to world UpDelay time.Duration // delay between downing interface and announcement DownDelay time.Duration // how often to repeat already up announcements ReAnnounce time.Duration // how often to repeat already up withdraws ReWithdraw time.Duration sync.RWMutex // contains filtered or unexported fields }
func NewEngine ¶
func NewEngine(r RouteEngine) (e *Engine, err error)
func (*Engine) RegisterRoute ¶
func (e *Engine) RegisterRoute(route string, nexthop string, extra string, healthcheck RouteHealthcheck) (err error)
register route each route also needs to have healthcheck implementing RouteHealthcheck interface each route will be set ONCE, which means any subsequent changes to same tuple of route+nexthop will be ignored. Drop it before if you want to change config
func (*Engine) UpdateState ¶
func (e *Engine) UpdateState()
type Route ¶
type Route struct { // route Route string // next hop of the route NextHop string // extra parameters Extra string // whether route was announced Announced bool // whether route target is up Up bool LastUp time.Time LastDown time.Time LastAnnounced time.Time LastWithdrawn time.Time LastStateChange time.Time UpCount int DownCount int // 0-100 score that tracks how often routes flap. 1 flap is worth 10 points, deduced 1 each time state is steady FlapScore int sync.Mutex // contains filtered or unexported fields }
Route represents single route object. "Extra" is not used as a key so there can be no 2 routes with same extra field
func (*Route) SetAnnounced ¶
func (r *Route) SetAnnounced()
func (*Route) SetWithdrawn ¶
func (r *Route) SetWithdrawn()
type RouteEngine ¶
type RouteHealthcheck ¶
Click to show internal directories.
Click to hide internal directories.