GithubHelp home page GithubHelp logo

framey's Introduction

Intro

go.framey.io/speedtest library is created for measuring an internet connection speed by using multiple services: speedtest.net and fast.com

Usage

  • Import library "go get -u go.framey.io/speedtest
  • Do imports
	. "go.framey.io/speedtest"
	"go.framey.io/speedtest/internal/types"
  • Create a new measurement configuration
measurementConfiguration := types.DefaultConfiguration()
  • Adjust default timeout settings if necessary

    • ConfigTimeout: Timeout for getting fast.com/speed.net configuration before a test. Default: 5 seconds,
    • DownloadTimeout: Timeout for an each download operation in a thread pool. Default: 10 seconds,
    • UploadTimeout: Timeout for an each upload operation in a thread pool. Default: 10 seconds,
  • Adjust the result output format

    • MeasurementRatio: 1. Setting it to 1 will return speed in Bytes per Second
    • MeasurementRatio: 8 / float64(types.Mbps). Converts it to Mbits per Second
  • Create a new measurement by providing measurement endpoint and the configuration

    • To test speed with speedtest.net
      measurement := NewMeasurement(types.SpeedtestdotnetEndpoint, &measurementConfiguration)
      
    • To test speed with fast.com
      measurement := NewMeasurement(types.FastdotcomEndpoint, &measurementConfiguration)
      
  • Call either the Upload or Download test

	speed, err := Upload(&measurement)
	speed, err := Download(&measurement)
  • speed is normalized according to the specified configuration.MeasurementRatio

Makefile

The makefilie provided with the library allows to automate some routine tasks:

  • Running tests
    make test
    
  • Measuring tests coverage
    make test-coverage
    

Things to improve

  • It is possible to provide measurementCallback core.MeasurementCallback in the public library's API also
  • For the sake of the interface unification all servers's speed measurement initialization have been wrapped with Upload/Download method. It has own performance issue since for each Upload/Download execution it either get Fast.com token or servers for speedtest.net
  • It might make sense to extract a parameter that controls the number of attempts to measure the speed. This parameter is already there in the library.
  • Create more unit tests. However, since the library is based on another one internally, that is not the obvious task because of its internal architecture. So, such tests will mainly be mock-based tests.

Benchmarks

I do not see any reasons with the current structure of library providing any benchmarks, since that its code is only about initializing and calling other methods.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.