Monitoring
The monitoring helper allows you to check and monitor the uptime status of an IP. This is useful for uptime checking when returning DNS records. It takes a single IP parameter that is then monitored in the background. The first time an IP is called, it is added into a background monitoring service while synchronously waiting for the initial latency. Once the IP is called again from the same server, the result is returned immediately.Functions
Monitoring.getStatus(IP: string): MonitoringStatus
Returns the current status of the IP.MonitoringStatus
The monitoring status object is returned by theMonitoring.getStatus helper and contains the monitoring information of a specific IP.
| Field | Type | Description |
|---|---|---|
isOnline | boolean | The current status of the IP (true: online, false: offline) |
latency | integer | The last measured latency from the DNS server to this IP |
GeoDatabase
GeoDatabase is a wrapper around a GeoDNS library. It allows you to easily look up the geo location of an IP address.Functions
GeoDatabase.resolve(IP: string): GeoLocation
Returns the GeoLocation result for the specified IP based on a GeoDNS database.GeoDistance
GeoDistance contains helper methods to help you calculate the distance between two geographical points.Functions
GeoDistance.calculate(lat1: double, lon1: double, lat2: double, lon2: double): double
Returns the geographical distance between two geographical locations based on latitude and longitude.GeoDistance.calculate(loc1: GeoLocation, loc2: GeoLocation): double
Returns the geographical distance between two GeoLocation objects.GeoDistance.calculate(server: Server, location: GeoLocation): double
Returns the geographical distance between a Server object and a GeoLocation object.RoutingEngine
RoutingEngine helps with dynamic geographic routing, weight calculation, and round robin logic based on a list of servers.Functions
RoutingEngine.getWeightedRandom(servers: Array<Server>, onlineOnly: bool = false, applyWeight: bool = true): Server
Returns one server from an array of servers based on a round robin weighted random principle. Additionally, servers can be filtered by online servers only. To activate weights, the applyWeight parameter should be set to true.RoutingEngine.getClosestServer(servers: Array<Server>, location: GeoLocation, onlineOnly: bool = false, applyWeight: bool = true): Server
Returns one server from an array of servers based on a round robin weighted random principle that is closest to the given GeoLocation parameter. Additionally, servers can be filtered by online servers only. To activate weights, the applyWeight parameter should be set to true.Server
The Server object is used to pass or return server information to various other helper methods and does not contain any functionality by itself.Constructor
Fields
| Field | Type | Description |
|---|---|---|
ip | string | The IP of the server |
latitude | double | The geographical latitude of the server’s location |
longitude | double | The geographical longitude of the server’s location |
weight | int | The routing weight of the server in a weighted routing scenario |