swift-project / pilotclient

Cross-platform cross-simulator pilot client for virtual air traffic networks
https://swift-project.org
GNU General Public License v3.0
91 stars 26 forks source link

Fetch VATSIM servers from separate server file #191

Closed ltoenning closed 1 year ago

ltoenning commented 1 year ago

Currently we use the full data file https://data.vatsim.net/v3/vatsim-data.json to fetch the VATSIM server list. Some other data like flightplans are used from that file as well.

With the new load-balancing "VATSIM" server, this file is not in sync with https://data.vatsim.net/v3/vatsim-servers.json and might be deprecated in the future.

We should switch to vatsim-servers.json for fetching the servers. Maybe we can also remove some/all other features that uses data from vatsim-data.json.

nharasym commented 1 year ago

VATSIM now has two ways to get an IP to connect to FSD that is the preferred and soon required way. vpilot and xpilot have implemented the following in their clients.

"what I was thinking is keep things as they are, in that vPilot will still download the server list on startup, and it'll still auto-select the AUTOMATIC entry if it's in the list ... then when it comes time to actually connect, if the AUTOMATIC server is still selected, first do the HTTP call, and if that fails, fall back to the current process (which will do a normal DNS resolution on the AUTOMATIC server's address)"

"if the user has AUTOMATIC server selected (which I force on startup but let them override) I call the endpoint, take the response and trim whitespace, verify that it looks like an ipv4 address using a regex, and use it to connect ... if anything fails it uses the regular DNS lookup"

HTTP: http://fsd-http.connect.vatsim.net DNS: fsd.connect.vatsim.net

The hope is Swift can implement the same / similar. HTTP requests provide more accurate results, DNS is less accurate due to how EDNS ECS works / resolvers work. And then the list is for fallback in an event we push a server list if HTTP / DNS is failing for an extended period of time.

ltoenning commented 1 year ago

Implemented with alpha version 0.12.103. As requested, we will bump the minor version soon.