Technical Design of QuickServerCheck

From Acacia Support Wiki
Jump to navigation Jump to search

This app was written based on SwitfUI and the SwiftyPing package to send ICMP (pings) to remote hosts.

A timer continually scans the list of enabled hosts and pings them in a background thread. Throttling ensures that each host is only every pinged once every 2 seconds.

All details for each host are held in an array of name/value pairs and stored in user settings. When the app is restarted, previous host settings are used to automatically register these hosts and load up their details. This caching allows network request to be minimised.

If the user provides a new host name, the URL is cleaned up and passed into a DNS lookup to get and store the IP address.

As hosts are registered in the app, they are queued for the lookup of additional details such as GPS location from IPInfo.

All hosts that have registered GPS locations are automatically displayed on the Apple map.

As hosts are pinged, a geodescic line is drawn from the current host location to the remote host location. Ping results pushed into a FIFO queue and are graphed using the Charts package. Data is automatically re-scaled and the Y-Axis is recalculated to display the highest value.

The random list of publically available IP addresses for sample hosts in a number of countries is held in a JSON string. This is unpacked at run time to form the "Check" --> "Load Hosts - xx" menu items. This may be changed in future releases to load this from a web site.

Menu items and all of the UI is implemented using SwiftUI. The only exception is the MKMapView that needed to be wrapped in a NSViewRepresentable in order to make full use of its features.

The Charts package was used to present the chart. Data is linked to a FIFO queue with extra logic to present scaled results from 0..1 and to adjust the y-axis scale.