showwin/speedtest-go

--server option is not working

Closed this issue · 7 comments

Whatever how many --server options I passed, speedtest-go always behaviors like without --server options.

speedtest-go version: 1.1.2

Interesting when I pass something like speedtest-go --server helloworld, I can got an error error: strconv.ParseFloat: parsing "helloworld": invalid syntax, try --help.
This means the arguments parser (alecthomas/kingpin) is working, I guess there must be something wrong in the project itself.

Hi @hronro , thank you for using speedtest-go!

In my environment, --server option works well.

$ speedtest --version
1.1.2


$ speedtest                             
Testing From IP: 202.12.244.3, (GLBB Japan KK) [35.6669, 139.6941]
 
Target Server: [36782]     2.07km Tokyo (Japan) by 沪日华莱喷射战士!
Latency: 35.68066ms
Download Test: .........................
Upload Test: ........
 
Download:  7.02 Mbit/s
Upload: 71.62 Mbit/s


$ speedtest --server 28910 --server 7139
Testing From IP: 202.12.244.3, (GLBB Japan KK) [35.6669, 139.6941]
 
Target Server: [28910]     2.07km Tokyo (Japan) by fdcservers.net
Latency: 9.962783ms
Download Test: ........
Upload Test: ......
 
Download: 72.96 Mbit/s
Upload: 90.05 Mbit/s

 
Target Server: [7139]    52.86km Tsukuba (Japan) by SoftEther Corporation
Latency: 62.457559ms
Download Test: ...................
Upload Test: ..........
 
Download: 30.00 Mbit/s
Upload: 60.52 Mbit/s

Download Avg: 51.48 Mbit/s
Upload Avg: 75.29 Mbit/s

If server_id is not valid, this behaviors like without --server options.

$ speedtest --server 9999999999         
Testing From IP: 202.12.244.3, (GLBB Japan KK) [35.6669, 139.6941]
 
Target Server: [36782]     2.07km Tokyo (Japan) by 沪日华莱喷射战士!
Latency: 17.959927ms
Download Test: .................................
Upload Test: ...................
 
Download:  8.74 Mbit/s
Upload: 28.84 Mbit/s

Please confirm that your server_id is in the list which could be fetched by $ speedtest --list

$ speedtest --list
Testing From IP: 202.12.244.3, (GLBB Japan KK) [35.6669, 139.6941]
[36782]     2.07km Tokyo (Japan) by 沪日华莱喷射战士!
[28910]     2.07km Tokyo (Japan) by fdcservers.net
[20976]     2.07km Tokyo (Japan) by GLBB Japan
[24333]     2.07km Tokyo (Japan) by Rakuten Mobile, Inc
[15047]     2.07km Tokyo (Japan) by OPEN Project (via 20G SINET)
[19256]     2.07km Tokyo (Japan) by love4taylor.com
....

@showwin Thank you for your reply. Actually I didn't use the server IDs from speedtest --list, since speedtest --list only give me limited numbers of servers. I got server IDs by checking the browser devtools when searching servers in speedtest.net. I thought those IDs was valid for speedtest-go.

Using IDs from speedtest-go --list works, but is there a way to use IDs not in that list?

I got server IDs by checking the browser devtools when searching servers in speedtest.net.

Could you tell me how did you get server IDs by browser devtools?
This tool gets server IDs from https://www.speedtest.net/speedtest-servers-static.php. Though if there is another way to get them, I'll consider to adopt it 👍

In my opinion, server IDs near your location could get by using --list option. It may be rare case to speedtest to distant server.

@showwin
The searching API is GET https://www.speedtest.net/api/js/servers?engine=js&search={keyword}&https_functional=true&limit=100, but I'm not sure if it is a public API.

@hronro Sorry for late responce.
Thank you for your information! I think such a usage is not so common, therefore I would not implement this tool to adopt to any server ID.
Though if you need, I welcome your Pull-Request.