fix: check if rootID has DNSLink before uninlining
This kinda enables to run their custom DNS resolver with custom tlds/names that are independent from the public DNS network.
Marcin Rataj committed
Jan 14, 2021 at 20:14 UTC
f932510b88a08bb674e4191431b3d33a7b3ec690
1 file changed
+8
-5
core/corehttp/hostname.go
+8
-5
@@ -209,11 +209,14 @@ func HostnameOption() ServeOption {
209
// TLS cert if represented as a single DNS label:
210
// https://my-v--long-example-com.ipns.dweb.link
211
if ns == "ipns" && !strings.Contains(rootID, ".") {
212
- // my-v--long-example-com → my.v-long.example.com
213
- dnslinkFQDN := toDNSLinkFQDN(rootID)
214
- if isDNSLinkName(r.Context(), coreAPI, dnslinkFQDN) {
215
- // update path prefix to use real FQDN with DNSLink
216
- pathPrefix = "/ipns/" + dnslinkFQDN
212
+ // if there is no TXT recordfor rootID
213
+ if !isDNSLinkName(r.Context(), coreAPI, rootID) {
214
+ // my-v--long-example-com → my.v-long.example.com
215
+ dnslinkFQDN := toDNSLinkFQDN(rootID)
216
+ if isDNSLinkName(r.Context(), coreAPI, dnslinkFQDN) {
217
+ // update path prefix to use real FQDN with DNSLink
218
+ pathPrefix = "/ipns/" + dnslinkFQDN
219
+ }
220
}
221
}
222
}