Coder Social home page Coder Social logo

miquels / speedtest Goto Github PK

View Code? Open in Web Editor NEW
90.0 13.0 30.0 1.23 MB

HTML5 speedtest, javascript client and golang server. Responsive interface, can be used on desktop, tablets and phones. Uses the same algorithm as Ookla / speedtest.net, and gives approximately the same results.

JavaScript 18.26% HTML 0.84% Vue 47.64% Makefile 0.47% Go 4.22% Rust 24.04% SCSS 4.53%
speedtest html5-speedtest vuejs vuex

speedtest's Introduction

speedtest

========================================

THIS REPOSITORY HAS BEEN ARCHIVED AS OF 02-May-2021

This project will not be developed any further.

========================================

HTML5 Speedtest

This speedtest uses the same algorithm as the Ookla / speedtest.net test. Because of that it gives about the same results.

It has a responsive interface, and can be used on desktop, tablets and phones.

speedtest-dark

Development / Build Setup

  • as usual, you need nodejs and yarn.
  • you need to have Rust (compiler + cargo) installed, version 1.40 or later.

Right now no Linux distributions come with a recent enough Rust. You need to install it manually. Instructions can be found on https://rustup.rs/, but for Linux and macos it boils down to:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then clone the repo and build:

# clone repo
git clone https://github.com/miquels/speedtest.git
cd speedtest

# install dependencies
yarn

# install configuration file
cp public/config.json.example public/config.json
vim public/config.json

# serve with hot reload at localhost:8080
yarn serve

Run the backend server

# build backend server
cd server
source ~/.cargo/env # should not be needed, but try if the below fails.
cargo build --release
cd ..

# run server
server/target/release/speedtest-server

If you point yout browser at localhost:8080, you should see the webinterface.

If it doesn't work, use your browsers debugger/inspector, and look at the javascript console - that should give you a hint as to what is going on. For example, Chrome on OSX, press Option + Command + J.

Production use

# build and minify.
yarn build

# copy files to your webservers root. change /path/to/www/html to the
# actual path on your system (e.g. debian: /var/www/html).
cp -av dist/* /path/to/www/html/

Before you can use the app, you need to run the backend server as well.

Running the backend server.

If you have compiled the server as described above, its binary needs to be copied to a generic location, for example:

cp server/target/release/speedtest-server /usr/local/sbin/speedtest-server

The server needs to be run as a daemon. That's OS specific, and no sysv / systemd / whatever files have been included yet. The easiest solution is to run it in a screen session for now :)

screen
/usr/local/sbin/speedtest-server
# Press "Control-a d" to detach
# Use "screen -x" to re-attach

There are several command line options you can use, such as:

  • --key, --chain: options for TLS (SSL) support
  • --dir: serve the entire app, not just the speedtest backend
  • --listen: address/port to listen on (default 4000)
  • --help: get a list of all options.

For example, to serve TLS on port 443:

/usr/local/sbin/speedtest-server --key certificate.key \
        --chain certificate.pem --listen 443 --dir /var/www/html/speedtest
# Note: set `apiport` in `config.json` to 443, or just comment it out.

Note that the server does not write any access logs. If you do need access logs, you can get them (at least for the application itself, html/css/javascripts/assets) by serving the application using a generic webserver like Apache or Nginx, and running the api server on a separate port.

speedtest's People

Contributors

dependabot[bot] avatar kukac7 avatar miquels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

speedtest's Issues

Unable to configure Speedtest

Hi Team,

Thank you for the great script to test the internet speed, I'm running into issues when I try to replicate the process outlined there. I have installed all the requirements (nodejs, yarn, go compiler) for this algorithm to run however I'm not able to install it, can anyone advise me, please?
I'm not able to run the below steps, please see error screenshot

install configuration file

cp static/config.json.example static/config.json
vim static/config.json

serve with hot reload at localhost:8080

yarn serve

build for production with minification

yarn build
speed test error

No timeout or any fencing mechanism on the http server

I installed the service on a pretty heavy hardware and I noticed that for some reason there are spikes of 100% CPU load on one core from one of the http service procceses.
I reviewed the service and found out that someone with enough bandwidth can hammer the server without any limit.
I added a feature that fences the service from staying in the for loops for more then a specific ammount of seconds(cli flag\variable).
I also believe that in a public facing speed testing service logging should be turned off by default and should be turned on only for debugging since the service can be flooded with lots of connections.

SSL/TLS

Test doesn't start if front-end loaded via SSL/TLS (no matter what signed or unsigned cert), my current settings: Apache2 web server, speedtest back-end running on same host (running on different host doesn't change a thing) and protocol value set to http in config.json since I guess this is related to back-end running mode which in my case is plain HTTP.

Tried some standard-like setups sadly with no luck.

Any suggestions? Thanks!

UPDATE

My bad, once again: just needed to run back-end in HTTPS...

Not working over WAN

Great piece of software, sadly I'm having hard time getting it going over WAN.

Test over (W)LAN

LAN.mp4

Test over WAN (same setup as before, just launched from a separate internet access)

WAN.mp4

As you can see, it seems to be stuck due to some reason I'm unable to pinpoint, no errors entries in web server log neither in speedtest server output...any suggestions? Thanks!

UPDATE

I eventually managed to get it working...or rather turned out was my fault: I had to fix a couple of rules in my firewall...

bargraph don't work

Hello,

I'm testing this app in order to excersize with Vue.js.
I've a problem with the bar graphs, they simply remain blank while the test runs fine and complete. I've checked the code and I can't seem to find the culrpit here.

Thanks

Missing wsip in server-go

Maybe this was forgotten, or you didn't want to implement this.
But the /speedtest/wsip endpoint doens't exists in the server-go. Which gives me errors in the client console.

Im not able to run the Rust server, so that doens't fix it either

error while installing with yarn MacOS

make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/xxxxx/Vue/speedtest/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/Cellar/node/12.3.1/bin/node" "/Users/xxxxxxx/Vue/speedtest/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/xxxxxxx/Vue/speedtest/node_modules/node-sass
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this

Any idea how to fix that issue?

Thanks so much

X-Forwarded-For support

Would it be possible to add X-Forwarded-For or another header name that will reflect the real client IP when the service is being a WAF?

TLS is required for a real public facing service

I have tested this service and these days with TLS everywhere you must run the service with TLS.
The basic static files can be served under any generic web service ie: apache\nginx etc.
However the api/speedtest service run's by default in plain HTTP which browsers do not allow.
(A mix of secure and non-secure urls)

To resolve this issue what I am doing adding the:
Upgrade-Insecure-Requests: 1 header and the browsers automatically tries to upgrade the websocket and api connections with TLS.

What left to do on the speedtest api service is to add a TLS port and add the header into the default port.

make: *** [get] Error 127

Hi want try you project, i think him is great.

But when i ll run comand # yarn run build-server
receive this error msg:

yarn run v0.21.3
$ make -C server
make: Entering directory '/var/www/html/sp/server'
server: getting dependencies..
go get
make: go: Comando não encontrado
Makefile:14: recipe for target 'get' failed
make: *** [get] Error 127
make: Leaving directory '/var/www/html/sp/server'
error Command failed with exit code 2.

Any idea about this problem?

My system debian jessie, build-essential ok,

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.