A high-performance web service that checks if a target domain is included (directly or indirectly) in another domain's SPF (Sender Policy Framework) record chain.
- 🚀 Fast asynchronous DNS lookups
- 🔄 Recursive checking of SPF include chains
- 📋 Returns complete SPF record and include chain information
- 💓 Health check endpoint
- 🔒 Secure and efficient with Rust
- 🌐 Easy to use HTML UI
Checks if a target domain is included in another domain's SPF record chain.
GET /api/v1/check-spf?domain={domain}&target={target}domain: The domain to check the SPF record for (e.g.,example.com)target: The domain to look for in the SPF include chain (e.g.,_spf.example.com)
{
"found": true,
"checked_domains": 3,
"domain": "example.com",
"target": "spf.protection.outlook.com",
"elapsed_ms": 42,
"has_spf_record": true,
"spf_record": "v=spf1 include:spf.protection.outlook.com -all",
"included_domains": ["spf.protection.outlook.com"],
"fallback_check": false
}found: Boolean indicating if the target was found in the SPF chainchecked_domains: Number of domains checked in the processdomain: The original domain that was checkedtarget: The domain that was searched forelapsed_ms: Time taken for the check in millisecondshas_spf_record: Boolean indicating if the domain has an SPF recordspf_record: The complete SPF record of the main domain (if exists, otherwisenull)included_domains: List of domains included in the main SPF record (if exists, otherwisenull)fallback_check: Boolean indicating if a fallback check was performed (if the target was not found in the SPF record)
{
"error": "DNS_LOOKUP_FAILED"
}Common error codes:
DNS_LOOKUP_FAILED: Unable to perform DNS lookup orTXTrecord does not existSPF_PARSE_FAILED: Invalid SPF record format
GET /healthReturns 200 OK if the service is running.
http://localhost:8080/uiReturns a simple HTML UI for checking SPF records.
Check if outlook.com's SPF is included in example.com's SPF chain:
curl "http://localhost:8080/api/v1/check-spf?domain=example.com&target=spf.protection.outlook.com"- Ensure you have Rust installed
- Clone the repository
- Build and run:
cargo build --release
./target/release/spf-checkThe service will listen on 0.0.0.0:8080 by default.
- Asynchronous processing allows handling multiple requests simultaneously
- Each request maintains its own state, preventing cross-request interference
- Efficient DNS caching through the trust-dns-resolver
- axum: Web framework
- tokio: Async runtime
- trust-dns-resolver: DNS resolution
- decon-spf: SPF record parsing
- serde: Serialization/Deserialization
- chrono: Timestamp formatting