could use a ranking limiter
Closed this issue · 10 comments
A very cool feature was to be able to do
pacman-mirrors -g -m rank -l 5
where -l limits to 5 fastest mirrors instead of ranking full list.
Use case would be in live session to ensure we always start with the fastest mirror regardless of location.
How do you know which are the fastest mirrors if you don't rank all of them previously? This will cut the final result to only 5 mirrors, but you will still need to check every mirror.
Right, I know, but the other part is eventually make it easier to match a language or locale against a mirror location. Eg we rename Germany -> DE and so on.
Anyway, the mirror randomizer is not the best solution, with bad luck, you still get slow mirror which makes everything internet related in CAL fragile. Our live session needs to know somehow fastest mirror without much increase of boot time.
We should use GeoIP like we do with CAL. Simply check how it was done in locale module.
It is really simple. Simply call http://freegeoip.net/json/ and you get some like this:
{"ip":"XX.XX.XXX.XX","country_code":"XX","country_name":"Germany","region_code":"XX","region_name":"Region","city":"City","zip_code":"12345","time_zone":"Timezone","latitude":XX.XXXX,"longitude":YY.YYYY,"metro_code":X}
However CVS (http://freegeoip.net/csv) seems to be easier:
XX.XX.XXX.XX,XX,Germany,XX,Region,City,12345,Timezone,XX.XX,YY.YY,X
Then we simply check if we have a mirror for that Country and only use that for ranking. Simply needs testing ...
Ok, using geoip sounds like a good idea.
However we should make it optional and not enabled by default.
I'd also propose we run the ranking with a alpm hook instead of post_install for the package.