You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package iperf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TestMode string
|
|
|
|
|
|
|
|
const (
|
|
|
|
MODE_JSON TestMode = "json"
|
|
|
|
MODE_LIVE TestMode = "live"
|
|
|
|
)
|
|
|
|
|
|
|
|
type SharedOptions struct {
|
|
|
|
Port *int
|
|
|
|
Format *rune
|
|
|
|
Interval *int
|
|
|
|
JSON *bool
|
|
|
|
LogFile *string
|
|
|
|
}
|
|
|
|
|
|
|
|
type DebugScanner struct {
|
|
|
|
Silent bool
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ds *DebugScanner) Scan(buff io.ReadCloser) {
|
|
|
|
if buff == nil {
|
|
|
|
fmt.Println("unable to read, ReadCloser is nil")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
scanner := bufio.NewScanner(buff)
|
|
|
|
scanner.Split(bufio.ScanWords)
|
|
|
|
for scanner.Scan() {
|
|
|
|
text := scanner.Text()
|
|
|
|
if !ds.Silent {
|
|
|
|
fmt.Println(text)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|