Skip to content

Commit

Permalink
Set DoH servers for the local gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Sep 30, 2024
1 parent 293fe32 commit 64f0eb4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Planet/IPFS/IPFSCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ struct IPFSCommand {
])
}

static func setResolvers(resolversJSON: String) -> IPFSCommand {
IPFSCommand(arguments: [
"config",
"DNS.Resolvers",
resolversJSON,
"--json",
])
}

static func setSwarmConnMgr(_ jsonString: String) -> IPFSCommand {
IPFSCommand(arguments: [
"config",
Expand Down
18 changes: 18 additions & 0 deletions Planet/IPFS/IPFSDaemon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,18 @@ actor IPFSDaemon {
Self.logger.info("Unable to set peers for IPFS")
}

Self.logger.info("Set DNS resolvers")
if let result = try? IPFSCommand.setResolvers(
resolversJSON: String(data: IPFSDaemon.resolvers.rawData(), encoding: .utf8)!
).run(),
result.ret == 0
{
Self.logger.info("Set DNS resolvers")
}
else {
Self.logger.info("Unable to set DNS resolvers")
}

let swarmConnMgr = JSON(
[
"GracePeriod": "20s",
Expand Down Expand Up @@ -757,6 +769,12 @@ extension IPFSDaemon {
],
] // Filebase
])
// DoH resolvers
static let resolvers = JSON([
"bit.": "https://dweb-dns.v2ex.pro/dns-query",
"sol.": "https://dweb-dns.v2ex.pro/dns-query",
"eth.": "https://dns.eth.limo/dns-query"
])

static func urlForCID(_ cid: String) -> URL? {
return URL(string: "https://\(cid).eth.sucks/")
Expand Down
2 changes: 1 addition & 1 deletion Planet/versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 2265
CURRENT_PROJECT_VERSION = 2266

0 comments on commit 64f0eb4

Please sign in to comment.