Merge pull request #874 from micro/tun-metrics
Add placeholders for link metrics
This commit is contained in:
		| @@ -85,6 +85,21 @@ func (l *link) expiry() { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Delay is the current load on the link | ||||||
|  | func (l *link) Delay() int64 { | ||||||
|  | 	return 0 | ||||||
|  | } | ||||||
|  |  | ||||||
|  | // Current transfer rate as bits per second (lower 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 { | func (l *link) Id() string { | ||||||
| 	l.RLock() | 	l.RLock() | ||||||
| 	defer l.RUnlock() | 	defer l.RUnlock() | ||||||
|   | |||||||
| @@ -57,6 +57,12 @@ type Tunnel interface { | |||||||
| type Link interface { | type Link interface { | ||||||
| 	// The id of the link | 	// The id of the link | ||||||
| 	Id() string | 	Id() string | ||||||
|  | 	// Delay is the current load on the link (lower is better) | ||||||
|  | 	Delay() int64 | ||||||
|  | 	// Length returns the roundtrip time as nanoseconds (lower is better) | ||||||
|  | 	Length() int64 | ||||||
|  | 	// Current transfer rate as bits per second (lower is better) | ||||||
|  | 	Rate() float64 | ||||||
| 	// Status of the link e.g connected/closed | 	// Status of the link e.g connected/closed | ||||||
| 	Status() string | 	Status() string | ||||||
| 	// honours transport socket | 	// honours transport socket | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user