From 4fddd69229e30f5c693606a2e31bfbf61e0bfbb0 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 22 Oct 2019 16:50:00 +0100 Subject: [PATCH] Add placeholders for link metrics --- tunnel/link.go | 15 +++++++++++++++ tunnel/tunnel.go | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/tunnel/link.go b/tunnel/link.go index 181121e7..580c6abd 100644 --- a/tunnel/link.go +++ b/tunnel/link.go @@ -85,6 +85,21 @@ func (l *link) expiry() { } } +// Delay is the current load on the link +func (l *link) Delay() int64 { + return 0 +} + +// Transfer rate capability as bits per second (higher is better) +func (l *link) Rate() float64 { + return float64(10e8) +} + +// Length returns the roundtrip time as nanoseconds (lower is better) +func (l *link) Length() int64 { + return time.Second.Nanoseconds() +} + func (l *link) Id() string { l.RLock() defer l.RUnlock() diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index a2671f62..cc03f07f 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -59,6 +59,12 @@ type Link interface { Id() string // Status of the link e.g connected/closed Status() string + // Delay is the current load on the link + Delay() int64 + // Transfer rate capability as bits per second (higher is better) + Rate() float64 + // Length returns the roundtrip time as nanoseconds (lower is better) + Length() int64 // honours transport socket transport.Socket }