Speedtest Module API Explanation
The Speedtest module provides lightweight internet connection telemetry without running a bandwidth test on every dashboard refresh.
API Execution Logic
The module exports createInternetService() and initializes network detection when the backend service starts. It stores the latest detected connection details in memory and returns that cached telemetry instantly on dashboard polling.
Request Execution
The module first queries https://ipwho.is/ with a 4-second timeout. If that request fails, it falls back to http://ip-api.com/json/.
Data Parsing
The response is parsed into a compact telemetry object:
- IP Address: Public internet address.
- Provider: ISP or connection provider.
- Location: City and country code or country name.
Metric Calculation
- Primary Metric: Public IP address.
- Secondary Metric: Internet provider.
- Raw Data: IP, provider, and location.
Caching Strategy
The module keeps the detected network telemetry in memory and returns the current value without triggering repeated bandwidth or latency tests.