speedtest-go
speedtest-go copied to clipboard
feat: validate the cc when using city params
when just use lat lon the countty not correct, with these fix can check the valid county by the cc
previous code not realy filter the cc, i just update it
Hi, @gandol. It doesn't seem to work because cc was not set when using lat and lon.
yeah its true, if the cc was not filtered set because of this
if s.config.Location != nil
so the filter can run only if the cc was set before i think when use lat lon the expected result was not filtered by the cc
We can preload cc from here.
const speedTestConfigUrl = "https://www.speedtest.net/speedtest-config.php"
In fact, filtering them has no practical effect, because the lat and lon parameters are determined by the ookla's server and they are always correct. Can you list a use case?
try using yishun
in CityFlag
config
the result not only shown list of server from cc of SG
but there is server from MY
and ID
to
This is normal, because location is searched within a rough radius. Even if you use the official speedtest, you will still get these results.
The intention of Location
is to modify your current location without doing too much processing on the results. It should not be a filter.
For now, I think the best way is to add a --cc
flag to filter them:
- disabled by default.
- auto attach by ookla's API.
eg: --cc=auto
- filter based on the provided cc.
eg: --cc=SG
try using
yishun
inCityFlag
config the result not only shown list of server from cc ofSG
but there is server fromMY
andID
to
CityFlag and CC(country code) are not related. CityFlag only maps to a build-in geographical coordinate.
For now, I think the best way is to add a
--cc
flag to filter them:
- disabled by default.
- auto attach by ookla's API.
eg: --cc=auto
- filter based on the provided cc.
eg: --cc=SG
if just use cc how to get the list of server, i was try use params of cc directly in url params can't get it it must add cityflag or use keyword or create an array of cc and keyword ?
We can preload cc from here.
const speedTestConfigUrl = "https://www.speedtest.net/speedtest-config.php"
- Through this api we can get the default cc, which depends on your network location.
- If the city flag is set, we can use the build-in cc instead of the default cc.
For now, I think the best way is to add a
--cc
flag to filter them:
- disabled by default.
- auto attach by ookla's API.
eg: --cc=auto
- filter based on the provided cc.
eg: --cc=SG
if just use cc how to get the list of server, i was try use params of cc directly in url params can't get it it must add cityflag or use keyword or create an array of cc and keyword ?
cc should be used with city location as much as possible.
@r3inbowari check my last commit, like that what you mean ?
I changed some code here.
examples:
./speedtest-go --city=tokyo -l // disable filter by default
./speedtest-go --city=tokyo --filter-cc=jp -l
./speedtest-go --city=hongkong --filter-cc=cn --filter-cc=hk -l // excludes MO servers which close to HongKong and includes CN
./speedtest-go --city=hongkong --filter-cc=auto -l // auto attach which decided by your network provider
./speedtest-go --location=xx,xx --filter-cc=jp -l
If there is no server for this cc in the area you specify, the result will be empty.
Do you think this is ok?
I changed some code here.
examples:
./speedtest-go --city=tokyo -l // disable filter by default ./speedtest-go --city=tokyo --filter-cc=jp -l ./speedtest-go --city=hongkong --filter-cc=cn --filter-cc=hk -l // excludes MO servers which close to HongKong and includes CN ./speedtest-go --city=hongkong --filter-cc=auto -l // auto attach which decided by your network provider ./speedtest-go --location=xx,xx --filter-cc=jp -l
If there is no server for this cc in the area you specify, the result will be empty.
Do you think this is ok?
hmm i think this is ok