Create a Tracker when starting the router

The tracker's HandleUpdate method is called by the ring update routines.

In addition, we add a dummy overlay for AWSVPC to make `weave (status|
report)` to produce reasonable reports which includes AWS hosts
connection state.
This commit is contained in:
Martynas Pumputis authored and Bryan Boreham committed 2016-06-08 16:44:54 +01:00
1 parent c260536429
commit 9fc7be83c8
6 files changed
+206 -55

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
package router
// A dummy overlay for the AWSVPC underlay to make `weave status` to return
// a valid information about peer connections.
import (
"github.com/weaveworks/mesh"
)
// mesh.OverlayConnection
type AWSVPCConnection struct {
establishedChan chan struct{}
errorChan chan error
}
func (conn *AWSVPCConnection) Confirm() {
// We close the channel to notify mesh that the connection has been established.
close(conn.establishedChan)
}
func (conn *AWSVPCConnection) EstablishedChannel() <-chan struct{} {
return conn.establishedChan
}
func (conn *AWSVPCConnection) ErrorChannel() <-chan error {
return conn.errorChan
}
func (conn *AWSVPCConnection) Stop() {}
func (conn *AWSVPCConnection) ControlMessage(tag byte, msg []byte) {
}
func (conn *AWSVPCConnection) DisplayName() string {
return "awsvpc"
}
// OverlayForwarder
func (conn *AWSVPCConnection) Forward(key ForwardPacketKey) FlowOp {
return DiscardingFlowOp{}
}
type AWSVPC struct{}
func NewAWSVPC() AWSVPC {
return AWSVPC{}
}
// mesh.Overlay
func (vpc AWSVPC) AddFeaturesTo(features map[string]string) {}
func (vpc AWSVPC) PrepareConnection(params mesh.OverlayConnectionParams) (mesh.OverlayConnection, error) {
conn := &AWSVPCConnection{
establishedChan: make(chan struct{}),
errorChan: make(chan error, 1),
}
return conn, nil
}
func (vpc AWSVPC) Diagnostics() interface{} {
return nil
}
// NetworkOverlay
func (vpc AWSVPC) InvalidateRoutes() {}
func (vpc AWSVPC) InvalidateShortIDs() {}
func (vpc AWSVPC) StartConsumingPackets(localPeer *mesh.Peer, peers *mesh.Peers, consumer OverlayConsumer) error {
return nil
}
+1 -1
View File
@@ -36,7 +36,7 @@ func (NullBridge) Interface() *net.Interface {
}
func (NullBridge) String() string {
return "<no bridge networking>"
return "no overlay bridge"
}
func (NullBridge) Stats() map[string]int {