SupaDNS (Rust)
Bypass blocked DNS for Supabase using DNS-over-HTTPS (DoH).
If your ISP blocks *.supabase.co via DNS poisoning, standard HTTP requests will fail. supadns provides a wrapper around reqwest that detects these DNS failures and transparently routes the connection through DNS-over-HTTPS (Quad9 and Cloudflare) while preserving strict TLS SNI validation.
Add to Cargo.toml
[]
= "1.0"
= { = "0.12", = false, = ["rustls-tls", "json"] }
= { = "1", = ["full"] }
Quick Start
SupaDNS intercepts requests to *.supabase.co. If system DNS fails, it automatically falls back to DoH.
use smart_get;
use HeaderMap;
async
Advanced Requests
For POST, PATCH, or custom payloads, use smart_request:
use smart_request;
use Method;
let mut headers = new;
// ... setup headers
let body = br#"{"task": "buy milk"}"#.to_vec;
let resp = smart_request.await.unwrap;
Standalone DoH Resolution
If you just need to bypass DNS and get the IPv4 address:
use resolve_doh;
async
How It Works (TLS SNI Preservation)
The hardest part of direct IP connection with Cloudflare is preserving TLS SNI.
- System DNS First: Always tries a standard
reqwestcall first. - Failure Detection: Catches DNS/timeout errors specifically for
*.supabase.codomains. - DoH Fallback: Resolves the IPv4 address via
https://dns.quad9.net/dns-query. - TLS SNI: Uses
reqwest::ClientBuilder::resolve(hostname, ip). This tellsreqwestandrustlsexactly which IP to dial, but preserves the original hostname in the URL so the SSL certificate is strictly verified and the HTTPHostheader remains correct.
Requirements
- Rust ≥ 1.70
reqwest(must userustls-tlsfeature)tokio
License
MIT