taganaka / SpeedTest

Yet another unofficial speedtest.net client cli interface
330 stars 83 forks source link

Ability to test based on Server ID Number #15

Open jbtt3615 opened 6 years ago

jbtt3615 commented 6 years ago

How can I run this tool and test based on Server ID number? I want to pass it list of 5 or more server IP's for approved servers and have it select the best from the 5.

taganaka commented 6 years ago

This feature is not supported yet. There's --test-server host:port option but it accepts a single host only.

You can "hack" it in this way:

1) Create your xml hosts file:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
   <servers>
     <server url="http://88.84.191.230/speedtest/upload.php" lat="70.0733" lon="29.7497" name="Vadso" country="Norway" cc="NO" sponsor="Varanger KraftUtvikling AS" id="4600"  url2="http://speedmonster.varangerbynett.no/speedtest/upload.php" host="88.84.191.230:8080" />
  </servers>
</settings>

2) Host it somewhere

3) Change this setting to point to your custom hosts file url https://github.com/taganaka/SpeedTest/blob/master/CMakeLists.txt#L12

4) Recompile

jbtt3615 commented 6 years ago

Okay Perfect! Thank you.

jbtt3615 commented 6 years ago

taganaka,

Not sure if this is out of line, but would like to discuss potentially contracting you to provide some additional tweaks to this app for a production environment. If that is possible, please let me know how best to get ahold of you.

jbtt3615 commented 6 years ago

Taganka,

Is there a way we can pull the XML file info from a local file on the device, rather than pull from a webserver?

taganaka commented 6 years ago

@jbtt3615 The program uses libcurl to fetch remote file, libcurl supports file schema uri There's a chance it would work out of the box by using file:///path/to/your/local/file.xml as SpeedTest_SERVER_LIST_URL value

taganaka commented 6 years ago

According to the doc, the uri file schema should look like this: file://localhost/path/to/file.xml

There's another problem though. I explicitly check for 200 HTTP_OK: https://github.com/taganaka/SpeedTest/blob/master/SpeedTest.cpp#L429-L432

I'm pretty sure fetching a local file would not return HTTP 200 as http_status. Changing it should be pretty straight forward

taganaka commented 6 years ago

@jbtt3615 This should do the trick.

Please give it a try:

https://github.com/taganaka/SpeedTest/pull/17

jbtt3615 commented 6 years ago

You are awesome.