Skip to content

Add multi-A-record DNS failover for WiFi HTTPS - #14

Merged
samuelbles07 merged 2 commits into
mainfrom
feat/wifi-multi-dns
Jun 27, 2026
Merged

Add multi-A-record DNS failover for WiFi HTTPS#14
samuelbles07 merged 2 commits into
mainfrom
feat/wifi-multi-dns

Conversation

@samuelbles07

Copy link
Copy Markdown
Collaborator

Summary

Adds DNS-level failover for WiFi HTTPS so the device can still reach the
AirGradient backend when some of the hostname's A records are
unreachable. Built on top of main's refactored WiFi client. Also folds
in two build fixes needed to compile main under the Arduino/PlatformIO
and ESP-IDF toolchains.

Changes

  • WiFi client now resolves all A records via a raw UDP DNS query, sticks
    to one IP, advances to the next on transport/TLS failure, and falls
    back to hostname resolution once all IPs are exhausted. TCP connects to
    the selected IP while TLS SNI and certificate verification stay on the
    hostname. Adds EndpointSelector.
  • Remove payload-encoder examples/ and test/ from the compiled src/
    tree; PlatformIO and arduino-cli compile every source under src/ and
    broke on their stale payload_encoder.h includes.
  • Guard ATCommandHandler::sendRaw byte write for the divergent serial
    APIs (AgSerial const char* on Arduino vs AirgradientSerial
    const uint8_t* on ESP-IDF).

Validation

  • Arduino: pio run -e esp32-c3 (OneOpenAir) compiles and links.
  • ESP-IDF (openair-max) compiles with the sendRaw guard.

Resolve all A records via raw UDP DNS, stick to one IP, advance on
each transport/TLS failure, fall back to hostname when exhausted. TCP
connects to the IP while SNI and cert verification stay on the
hostname. Ported onto main's refactored HTTP client.

Also drop payload-encoder examples/ and test/ from the compiled src
tree: PlatformIO and arduino-cli sweep every source under src/ and
broke on their stale payload_encoder.h includes.
AgSerial::write (Arduino) takes const char*, AirgradientSerial
(ESP-IDF) takes const uint8_t*. No single unguarded call compiles on
both, so branch on ARDUINO.
@samuelbles07
samuelbles07 merged commit 13e6b57 into main Jun 27, 2026
2 checks passed
@samuelbles07
samuelbles07 deleted the feat/wifi-multi-dns branch June 27, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant