Commit 49a999885f

49a999885fd23e59555429dbc111e3a3d87fd164

parent: fe83ff502f

Unsigned

cmc <hello@cleberg.net> · 2026-08-08 20:32 UTC

Add CodingKeys for external JSON decodables

Layout: unified · split

DomainDig/DNSLookupService.swift +3 −3
@@ -87,7 +87,7 @@ struct DNSLookupService {
8787 } else {
8888 value = answer.data.trimmingCharacters(in: CharacterSet(charactersIn: "\""))
8989 }
90 return DNSRecord(value: value, ttl: answer.TTL)
90 return DNSRecord(value: value, ttl: answer.ttl)
9191 }
9292 }
9393
@@ -202,8 +202,8 @@ struct DNSLookupService {
202202 let dnsResponse = try JSONDecoder().decode(CloudflareDNSResponse.self, from: data)
203203
204204 return DNSLookupResponse(
205 answers: dnsResponse.Answer ?? [],
206 authenticatedData: dnsResponse.AD ?? false
205 answers: dnsResponse.answer ?? [],
206 authenticatedData: dnsResponse.authenticatedData ?? false
207207 )
208208 }
209209
DomainDig/DomainViewModel.swift +1 −1
@@ -3564,7 +3564,7 @@ final class DomainViewModel {
35643564 if let org = ipGeolocation.org {
35653565 rows.append(InfoRowViewData(label: "Org / ISP", value: org, tone: .secondary))
35663566 }
3567 let location = [ipGeolocation.city, ipGeolocation.region, ipGeolocation.country_name].compactMap { $0 }.joined(separator: ", ")
3567 let location = [ipGeolocation.city, ipGeolocation.region, ipGeolocation.countryName].compactMap { $0 }.joined(separator: ", ")
35683568 if !location.isEmpty {
35693569 rows.append(InfoRowViewData(label: "Location", value: location, tone: .secondary))
35703570 }
DomainDig/Models.swift +23 −5
@@ -2144,10 +2144,16 @@ struct IPGeolocation: Codable {
21442144 let ip: String
21452145 let city: String?
21462146 let region: String?
2147 let country_name: String?
2147 let countryName: String?
21482148 let org: String?
21492149 let latitude: Double?
21502150 let longitude: Double?
2151
2152 enum CodingKeys: String, CodingKey {
2153 case ip, city, region
2154 case countryName = "country_name"
2155 case org, latitude, longitude
2156 }
21512157}
21522158
21532159// MARK: - Ownership Models
@@ -2616,14 +2622,26 @@ struct HistoryEntry: Identifiable, Codable {
26162622// MARK: - Cloudflare DNS-over-HTTPS Response
26172623
26182624struct CloudflareDNSResponse: Decodable {
2619 let Status: Int
2620 let AD: Bool?
2621 let Answer: [CloudflareDNSAnswer]?
2625 let status: Int
2626 let authenticatedData: Bool?
2627 let answer: [CloudflareDNSAnswer]?
2628
2629 enum CodingKeys: String, CodingKey {
2630 case status = "Status"
2631 case authenticatedData = "AD"
2632 case answer = "Answer"
2633 }
26222634
26232635 struct CloudflareDNSAnswer: Decodable {
26242636 let name: String
26252637 let type: Int
2626 let TTL: Int
2638 let ttl: Int
26272639 let data: String
2640
2641 enum CodingKeys: String, CodingKey {
2642 case name, type
2643 case ttl = "TTL"
2644 case data
2645 }
26282646 }
26292647}
DomainInspectionService.swift +2 −2
@@ -609,10 +609,10 @@ struct DomainInspectionService {
609609
610610 private func confidenceForGeolocation(result: IPGeolocation?) -> ConfidenceLevel {
611611 guard let result else { return .low }
612 if result.city != nil && result.country_name != nil && result.latitude != nil && result.longitude != nil {
612 if result.city != nil && result.countryName != nil && result.latitude != nil && result.longitude != nil {
613613 return .high
614614 }
615 if result.country_name != nil || result.org != nil {
615 if result.countryName != nil || result.org != nil {
616616 return .medium
617617 }
618618 return .low
DomainReportBuilder.swift +1 −1
@@ -440,7 +440,7 @@ struct DomainReportBuilder {
440440 return snapshot.ipGeolocationError ?? "Unavailable"
441441 }
442442
443 let parts = [geolocation.city, geolocation.region, geolocation.country_name]
443 let parts = [geolocation.city, geolocation.region, geolocation.countryName]
444444 .compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
445445 .filter { !$0.isEmpty }
446446