go-fast
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
Installation
go get -u gopkg.in/ddo/go-fast.v0
Workflow
#New
#Init
#GetUrls
#Measure
Example
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)
}
Debug
to enable log set environment variable as
DLOG=*
Test
go test -v