DNS
The Domain Name System
(DNS) is being used within FlightGear to look up resources providing several services. Its use started with release 2016.2.1 as an experimental feature to resolve the location of the TerraSync servers. This page documents the used services in detail.
FlightGear systems using DNS
These systems in FlightGear use DNS for service discovery:
- The TerraSync client to find a TerraSync server
- The multiplayer client to list multiplayer servers and retrieve information about each server
TerraSync
The TerraSync client queries NAPTR records
for the DNS name terrasync.flightgear.org. From the command line dig terrasync.flightgear.org ANY.
As of version 2024.1, the configured entries are:
- https://terrasync.eti.pg.gda.pl/ts
- https://terrasync.b-cdn.net/osm2city/
- https://terrasync.eti.pg.gda.pl/o2c
- http://mirrors.ibiblio.org/flightgear/ftp/
- https://download.flightgear.org/
- https://us1mirror.flightgear.org/terrasync/ws2/
(There are also scenery servers not listed above, e.g., https://flightgear.sourceforge.net/scenery/.)
At start, FlightGear sends a query for the DNS name terrasync.flightgear.org. The URL for scenery download is encoded in the regex field between the last two exclamation marks. This string MUST start with !^.*$! and must end with !, the regex itself is not interpreted by the TerraSync client, only the fixed string is taken.
The DNS to query is currently not configurable at system start by setting a property. The version number can be changed by setting property /sim/terrasync/scenery-version to a value other than the default "ws20".
Algorithm to pick a Server
- At startup, if TerraSync is enabled and if the property /sim/terrasync/http-server is set to "automatic" (the default), a DNS query for terrasync.flightgear.org is sent and the response filtered for entries with the flag field set to "U".
- All entries that have a "order" value higher than the lowest order are discarded. (the terrasync.b-cdn.net entry as of version 2024.1)
- The remaining entries are filtered for those with the lowest preference. (both other entries survive this filter)
- a random entry from the remaining list is picked for the entire session of FlightGear.
This is implemented in SGTerraSync::WorkerThread::run() here.
The property /sim/terrasync/http-server can be set to user defined URL pointing to the location of a custom TerraSync server e.g. http://myterrasync.org/custom-scenery.
This will disable the above algorithm.
Multiplayer
The multiplayer client queries SRV records
for a list of multiplayer servers and TXT records
on each server for detailed information about the server.
The SRV record for a multiplayer server looks like this:
_fgms._udp IN SRV 10 20 5001 mpserver01
All entries currently use the same values for priority and weight. The port numbers for active servers are set to the port number of the running fgms instance (usually 5001). The port number is 0 (zero) for inactive servers.
The TXT record for each referenced multiplayer server looks like this if you enter dig mpserver01.flightgear.org TXT:
mpserver01 IN TXT "flightgear-mpserver=eyJuYW1lIjoibXBzZXJ2ZXIwMSIsImxvY2F0aW9uIjoiRnJhbmtmdXJ0LEdlcm1hbnkifQo="
with the text data used as in RFC 1464 - Using the Domain Name System To Store Arbitrary String Attributes. The attribute name flightgear-mpserver marks this entry as "ours" while it's attribute value is a base64 encoded json string containing additional attributes for the server not available within the SRV record. For the given example, the base64 string of
eyJuYW1lIjoibXBzZXJ2ZXIwMSIsImxvY2F0aW9uIjoiRnJhbmtmdXJ0LEdlcm1hbnkifQo=
decodes to
{"name":"mpserver01","location":"Frankfurt,Germany"}
References
| References
|