summaryrefslogtreecommitdiff
path: root/DomainDig/DomainAvailabilityService.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-21 22:08:09 -0500
committerChristian Cleberg <[email protected]>2026-04-21 22:08:09 -0500
commit22ecca12b4fe0e0850401754c674632f322d919d (patch)
tree52845c3020c2471d607e7a1ad9681de83cbcbb85 /DomainDig/DomainAvailabilityService.swift
parent1f58092dcb67cded75a850db364f3b46d86181f3 (diff)
downloaddomain-dig-22ecca12b4fe0e0850401754c674632f322d919d.tar.gz
domain-dig-22ecca12b4fe0e0850401754c674632f322d919d.tar.bz2
domain-dig-22ecca12b4fe0e0850401754c674632f322d919d.zip
feat(v2.3.0): add ownership intelligence and subdomain discovery
* implement RDAP-based ownership section * add ownership diffing and change classification * add passive subdomain discovery via certificate transparency * highlight interesting subdomains * introduce Data+ scaffolding for future features * include ownership and subdomains in export and history
Diffstat (limited to 'DomainDig/DomainAvailabilityService.swift')
-rw-r--r--DomainDig/DomainAvailabilityService.swift51
1 files changed, 4 insertions, 47 deletions
diff --git a/DomainDig/DomainAvailabilityService.swift b/DomainDig/DomainAvailabilityService.swift
index 7bef586..9a350ef 100644
--- a/DomainDig/DomainAvailabilityService.swift
+++ b/DomainDig/DomainAvailabilityService.swift
@@ -35,32 +35,11 @@ struct DomainAvailabilityService {
}
private static func checkViaRDAP(domain: String) async -> DomainAvailabilityStatus? {
- guard let url = URL(string: "https://rdap.org/domain/\(domain)") else {
- return nil
- }
-
- do {
- var request = URLRequest(url: url, timeoutInterval: 8)
- request.setValue("application/rdap+json, application/json", forHTTPHeaderField: "Accept")
-
- let (data, response) = try await URLSession.shared.data(for: request)
- guard let httpResponse = response as? HTTPURLResponse else {
- return nil
- }
-
- switch httpResponse.statusCode {
- case 200:
- return isValidRDAPDomainResponse(data) ? .registered : nil
- case 404:
- debugLog("rdap-not-found", domain: domain, details: "Ignoring not-found response from rdap.org")
- return nil
- default:
- return nil
- }
- } catch {
- debugLog("rdap-error", domain: domain, details: error.localizedDescription)
- return nil
+ let status = await RDAPService.registrationStatus(for: domain)
+ if status == nil {
+ debugLog("rdap-not-found", domain: domain, details: "Ignoring unavailable response from rdap.org")
}
+ return status
}
private static func checkViaDNSFallback(domain: String) async -> DomainAvailabilityStatus {
@@ -85,28 +64,6 @@ struct DomainAvailabilityService {
}
}
- private static func isValidRDAPDomainResponse(_ data: Data) -> Bool {
- guard
- let object = try? JSONSerialization.jsonObject(with: data) as? [String: Any]
- else {
- return false
- }
-
- if object["ldhName"] as? String != nil {
- return true
- }
-
- if object["objectClassName"] as? String == "domain" {
- return true
- }
-
- if object["handle"] as? String != nil, object["unicodeName"] as? String != nil {
- return true
- }
-
- return false
- }
-
private static func suggestionCandidates(for domain: String, limit: Int) -> [String] {
let parts = domain.split(separator: ".")
guard parts.count >= 2 else { return [] }