fast.com api for go - pure - no headless browser or stuff
This package is the API for https://github.com/ddo/fast
Fast
: Minimal zero-dependency utility for testing your internet download speed from terminal
go get -u gopkg.in/ddo/go-fast.v0
#New
#Init
#GetUrls
#Measure
fastCom := fast.New()
// init
err := fastCom.Init()
if err != nil {
panic(err)
}
// get urls
urls, err := fastCom.GetUrls()
if err != nil {
panic(err)
}
// measure
KbpsChan := make(chan float64)
go func() {
for Kbps := range KbpsChan {
fmt.Printf("%.2f Kbps %.2f Mbps\n", Kbps, Kbps/1000)
}
fmt.Println("done")
}()
err = fastCom.Measure(urls, KbpsChan)
if err != nil {
panic(err)
}
to enable log set environment variable as
DLOG=*
go test -v