From f932510b88a08bb674e4191431b3d33a7b3ec690 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 14 Jan 2021 20:14:35 +0100 Subject: [PATCH] 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. --- core/corehttp/hostname.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/corehttp/hostname.go b/core/corehttp/hostname.go index 3ce1d08c26d..da133f7abe1 100644 --- a/core/corehttp/hostname.go +++ b/core/corehttp/hostname.go @@ -209,11 +209,14 @@ func HostnameOption() ServeOption { // TLS cert if represented as a single DNS label: // https://my-v--long-example-com.ipns.dweb.link if ns == "ipns" && !strings.Contains(rootID, ".") { - // my-v--long-example-com → my.v-long.example.com - dnslinkFQDN := toDNSLinkFQDN(rootID) - if isDNSLinkName(r.Context(), coreAPI, dnslinkFQDN) { - // update path prefix to use real FQDN with DNSLink - pathPrefix = "/ipns/" + dnslinkFQDN + // if there is no TXT recordfor rootID + if !isDNSLinkName(r.Context(), coreAPI, rootID) { + // my-v--long-example-com → my.v-long.example.com + dnslinkFQDN := toDNSLinkFQDN(rootID) + if isDNSLinkName(r.Context(), coreAPI, dnslinkFQDN) { + // update path prefix to use real FQDN with DNSLink + pathPrefix = "/ipns/" + dnslinkFQDN + } } } }