Skip to content
/ go-fast Public

fast.com api for go - pure - no headless browser or stuff

License

Notifications You must be signed in to change notification settings

ddo/go-fast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-fast Build Status Doc

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

About

fast.com api for go - pure - no headless browser or stuff

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages