spe
github.com/kylegrantlucas/speedtest
go get github.com/kylegrantlucas/speedtest
spe

github.com/kylegrantlucas/speedtest

A golang package for running speedtests against speedtest.net

go get github.com/kylegrantlucas/speedtest
Readme

speedtest

CircleCI Maintainability Test Coverage

A golang package for running speedtests against speedtest.net.

Usage

package main

import (
    "fmt"

    "github.com/kylegrantlucas/speedtest"
)

func main() {
    client, err := speedtest.NewDefaultClient()
    if err != nil {
        fmt.Printf("error creating client: %v", err)
    }
    
    // Pass an empty string to select the fastest server
    server, err := client.GetServer("")
    if err != nil {
        fmt.Printf("error getting server: %v", err)
    }

    dmbps, err := client.Download(server)
    if err != nil {
        fmt.Printf("error getting download: %v", err)
    }

    umbps, err := client.Upload(server)
    if err != nil {
        fmt.Printf("error getting upload: %v", err)
    }

    fmt.Printf("Ping: %3.2f ms | Download: %3.2f Mbps | Upload: %3.2f Mbps\n", server.Latency, dmbps, umbps)
}

Tests

go test ./...

Thanks

Major thanks to @zpeters for the excellent github.com/zpeters/speedtest package, which server as a major starting off point for this repo.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kylegrantlucas/speedtest. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The package is available as open source under the terms of the MIT License.

GitHub Stars

12

LAST COMMIT

4yrs ago

MAINTAINERS

0

CONTRIBUTORS

3

OPEN ISSUES

3

OPEN PRs

0
VersionTagPublished
v0.0.0-20180419014002-f8512f58e7ea
3yrs ago
No alternatives found
No tutorials found
Add a tutorial