Include selected overlay type in connection status

This commit is contained in:
Adam Harrison committed 2015-10-13 17:04:56 +01:00
1 parent da49e71eb8
commit 91afa7f7f4
5 files changed
+31 -1

No files matched your search

+4
View File
@@ -662,6 +662,10 @@ func (fwd *fastDatapathForwarder) ControlMessage(tag byte, msg []byte) {
}
}
func (fwd *fastDatapathForwarder) DisplayName() string {
return "fastdp"
}
func (fwd *fastDatapathForwarder) handleHeartbeatAck() {
log.Debug(fwd.logPrefix(), "handleHeartbeatAck")
+7
View File
@@ -88,6 +88,9 @@ type OverlayForwarder interface {
// compatibility, and should always be
// ProtocolOverlayControlMessage for non-sleeve overlays.
ControlMessage(tag byte, msg []byte)
// User facing overlay name
DisplayName() string
}
type NullOverlay struct{}
@@ -129,3 +132,7 @@ func (NullOverlay) Stop() {
func (NullOverlay) ControlMessage(byte, []byte) {
}
func (NullOverlay) DisplayName() string {
return "null"
}
+12
View File
@@ -393,3 +393,15 @@ func (fwd *overlaySwitchForwarder) ControlMessage(tag byte, msg []byte) {
subFwd.ControlMessage(msg[1], msg[2:])
}
}
func (fwd *overlaySwitchForwarder) DisplayName() string {
fwd.lock.Lock()
best := fwd.best
fwd.lock.Unlock()
if best == nil {
return "none"
}
return best.DisplayName()
}
+4
View File
@@ -593,6 +593,10 @@ func (fwd *sleeveForwarder) ControlMessage(tag byte, msg []byte) {
}
}
func (fwd *sleeveForwarder) DisplayName() string {
return "sleeve"
}
func (fwd *sleeveForwarder) Stop() {
fwd.sleeve.removeForwarder(fwd.remotePeer.Name, fwd)
+4 -1
View File
@@ -1,6 +1,7 @@
package router
import (
"fmt"
"time"
)
@@ -170,7 +171,9 @@ func NewLocalConnectionStatusSlice(cm *ConnectionMaker) []LocalConnectionStatus
if conn.Established() {
state = "established"
}
slice = append(slice, LocalConnectionStatus{conn.RemoteTCPAddr(), conn.Outbound(), state, conn.Remote().String()})
lc, _ := conn.(*LocalConnection)
info := fmt.Sprintf("%-6v %v", lc.forwarder.DisplayName(), conn.Remote())
slice = append(slice, LocalConnectionStatus{conn.RemoteTCPAddr(), conn.Outbound(), state, info})
}
for address, target := range cm.targets {
add := func(state, info string) {