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.
34 lines
477 B
Go
34 lines
477 B
Go
package iperf
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"io"
|
|
)
|
|
|
|
type TestMode string
|
|
|
|
const (
|
|
MODE_JSON TestMode = "json"
|
|
MODE_LIVE TestMode = "live"
|
|
)
|
|
|
|
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)
|
|
}
|
|
}
|
|
}
|