summaryrefslogtreecommitdiff
path: root/DomainDig/RedirectChainService.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-20 15:28:12 -0500
committerChristian Cleberg <[email protected]>2026-04-20 15:28:12 -0500
commitee2520f2c0c2d806fd284c3d6b8a81a3822f5270 (patch)
tree0680550a1071e01546ba074c2f20b1bf5a452238 /DomainDig/RedirectChainService.swift
parent4e94ee723cd19c964b1cf37792931e0c7c4614f4 (diff)
downloaddomain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.gz
domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.tar.bz2
domain-dig-ee2520f2c0c2d806fd284c3d6b8a81a3822f5270.zip
feat(v1.8): improve result structure, history, and consistency
- normalize sections and add summary card - fix resolver usage in reverse DNS - include custom port scans in history/export - standardize error handling - decompose ContentView into smaller views
Diffstat (limited to 'DomainDig/RedirectChainService.swift')
-rw-r--r--DomainDig/RedirectChainService.swift13
1 files changed, 9 insertions, 4 deletions
diff --git a/DomainDig/RedirectChainService.swift b/DomainDig/RedirectChainService.swift
index 541e118..d55a4aa 100644
--- a/DomainDig/RedirectChainService.swift
+++ b/DomainDig/RedirectChainService.swift
@@ -1,12 +1,17 @@
import Foundation
struct RedirectChainService {
- static func trace(domain: String) async throws -> [RedirectHop] {
- // Try HTTPS first (avoids ATS issues), fall back to HTTP if it fails entirely
+ static func trace(domain: String) async -> ServiceResult<[RedirectHop]> {
do {
- return try await followChain(startingURL: URL(string: "https://\(domain)")!)
+ let hops = try await followChain(startingURL: URL(string: "https://\(domain)")!)
+ return hops.isEmpty ? .empty("No redirect data available") : .success(hops)
} catch {
- return try await followChain(startingURL: URL(string: "http://\(domain)")!)
+ do {
+ let hops = try await followChain(startingURL: URL(string: "http://\(domain)")!)
+ return hops.isEmpty ? .empty("No redirect data available") : .success(hops)
+ } catch {
+ return .error(error.localizedDescription)
+ }
}
}