-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WhoisDns File #142
base: master
Are you sure you want to change the base?
Add WhoisDns File #142
Conversation
Add WhoisDnsModel file
import StoreKit | ||
import SwiftyStoreKit | ||
|
||
final class WhoisDns: DataFeedSingleton { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to SwiftWhois
? DNS == Domain Name System
public static var lookupService: IPLookupService = .init() | ||
|
||
class IPLookupService: Service { | ||
var name: String = "Simple IP Lookup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var name: String = "Simple IP Lookup"
-> var name: String = "Simple Whois Lookup"
return | ||
} | ||
|
||
DNSResolver.resolve(host: host) { error, addresses in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are supposed to use https://swiftpackageregistry.com/isaced/SwiftWhois
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use https://swiftpackageregistry.com/isaced/SwiftWhois and use it's data
Remove DnsResolver from FreeSwiftWhois class Add SwiftWhois.lookup in FreeSwiftWhois query metod Remove Addresss array from FreeSwiftWhois Model and response model for whoisData Create Codeable Model For WhoisData
Pass whoisData into Content Model
@@ -5,6 +5,7 @@ import Foundation | |||
import KeychainAccess | |||
import StoreKit | |||
import SwiftyStoreKit | |||
import SwiftWhois |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this line
@@ -45,6 +46,9 @@ extension LocalDns: DataFeedService { | |||
return | |||
} | |||
|
|||
do { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this block
throw URLError(.badURL) | ||
} | ||
|
||
return try await withCheckedThrowingContinuation { continuation in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
} | ||
|
||
return try await withCheckedThrowingContinuation { continuation in | ||
Task { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
import SwiftWhois | ||
|
||
|
||
struct FreeSwiftWhoisDataModel: Codable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? Let's make the actual content Codable
let copyData = try JSONEncoder().encode(dataModel) | ||
latestData = copyData | ||
dataToCopy = String(data: copyData, encoding: .utf8) | ||
content.append(.row(title: "Domain", content: dataModel.domainName ?? "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the data is missing let's just not display it.
Add WhoisDnsModel file
Closes #140