geolocate gateways and kd-tree
authorKali Kaneko <kali@leap.se>
Thu, 13 Dec 2018 13:45:27 +0000 (08:45 -0500)
committerKali Kaneko (leap communications) <kali@leap.se>
Thu, 13 Dec 2018 14:13:44 +0000 (15:13 +0100)
commit1223039a813fa836b3a7616225fc2d488b396249
tree08395d9428163a9680afae8496ae2c88c9208468
parent5540bc0f605f3d318a0b773861dcf26d21f9ef56
geolocate gateways and kd-tree

during initialization, we fetch the eip-config.json file from the
configured provider. we geolocate the gateways (using a golang package
that has some cities missing, hence the workaround) and
initialize a KD-Tree with the gateways.

using the KD-Tree, it is very cheap to calculate the nearest gateway for
every request, which is provider as a filed in the json to the client -
as a suggestion to be used or not in the gateway selection process.
gateways.go [new file with mode: 0644]
geo.go [new file with mode: 0644]
main.go