Skip to content

Commit

Permalink
fix: check if rootID has DNSLink before uninlining
Browse files Browse the repository at this point in the history
This kinda enables to run their custom DNS resolver with custom
tlds/names that are independent from the public DNS network.
  • Loading branch information
lidel committed Jan 14, 2021
1 parent 88dd257 commit f932510
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions core/corehttp/hostname.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}
Expand Down

0 comments on commit f932510

Please sign in to comment.