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.
Ben Grewell 328913249f add return of iperf pid 3 years ago
.idea add return of iperf pid 3 years ago
api add high level client/server sync controller 4 years ago
cmd add return of iperf pid 3 years ago
tests add macOS support 4 years ago
.gitignore initial working version 4 years ago
LICENSE initial working version 4 years ago
README.md add control wrapper 4 years ago
bindata.go add macOS support 4 years ago
client.go add return of iperf pid 3 years ago
controller.go fix merge error 3 years ago
execute.go add return of iperf pid 3 years ago
go.mod add macOS support 4 years ago
go.sum add macOS support 4 years ago
iperf.go Update iperf.go 3 years ago
protocol.go initial implementation 4 years ago
report.go added linux iperf processing 4 years ago
reporter.go add control wrapper 4 years ago
reporter_darwin.go fix merge error 3 years ago
reporter_linux.go add some debug print statements 4 years ago
reporter_windows.go add control wrapper 4 years ago
sample.json initial working version 4 years ago
server.go add return of iperf pid 3 years ago
shared.go add some debug print statements 4 years ago

README.md

go-iperf

A Go based wrapper around iperf3

Basic Usage

basic client setup

func main() {
	
	c := iperf.NewClient("192.168.0.10")
	c.SetJSON(true)
	c.SetIncludeServer(true)
	c.SetStreams(4)
	c.SetTimeSec(30)
	c.SetInterval(1)
	
	err := c.Start()
	if err != nil {
        fmt.Printf("failed to start client: %v\n", err)
        os.Exit(-1)
	}
	
	<- c.Done
	
	fmt.Println(c.Report().String())
}

basic server setup

func main() {
	
	s := iperf.NewServer()
	err := s.Start()
	if err != nil {
        fmt.Printf("failed to start server: %v\n", err)
        os.Exit(-1)
    }
    
    for s.Running() {
    	time.Sleep(100 * time.Millisecond)
    }
    
    fmt.Println("server finished")
}

client with live results printing

func main() {
	
	c := iperf.NewClient("192.168.0.10")
	c.SetJSON(true)
	c.SetIncludeServer(true)
	c.SetStreams(4)
	c.SetTimeSec(30)
	c.SetInterval(1)
	liveReports := c.SetModeLive()
	
	go func() {
	    for report := range liveReports {
	        fmt.Println(report.String())	
            }   	
        }   
	
	err := c.Start()
	if err != nil {
            fmt.Printf("failed to start client: %v\n", err)
            os.Exit(-1)
	}
	
	<- c.Done
	
	fmt.Println(c.Report().String())
}

building binary data package with iperf binaries

go-bindata -pkg iperf -prefix "embedded/" embedded/