Skip to content

Commit

Permalink
bootstrap: multiple ips for dns53
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Nov 24, 2023
1 parent c74a168 commit 4d5696a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions intra/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,24 @@ func (b *bootstrap) reinit(trtype, ippOrUrl, ipcsv string) error {
log.E("dns: default: reinit: ipport %s for %s", ippOrUrl, trtype)
return dnsx.ErrNotDefaultTransport
}
if ipport, err := xdns.DnsIPPort(ippOrUrl); err == nil {
ips := strings.Split(ippOrUrl, ",")
if len(ips) <= 0 {
log.E("dns: default: reinit: empty ipport %s", ippOrUrl)
return dnsx.ErrNotDefaultTransport
}
// todo: tests just the first ipport; test all?
if _, err := xdns.DnsIPPort(ips[0]); err == nil {
b.url = ""
b.hostname = protect.UidSelf
b.ipports = ipport.String()
b.ipports = ippOrUrl
b.typ = dnsx.DNS53
} else {
return err
}
}

// hydrate ipmap with the new ips against incoming hostname
ok := dialers.Renew(b.hostname, strings.Split(ipcsv, ","))
ok := dialers.Renew(b.hostname, strings.Split(b.ipports, ","))

log.I("dns: default: %s reinit %s %s w/ %s; resolved? %t", trtype, b.url, b.hostname, ipcsv, ok)

Expand Down

0 comments on commit 4d5696a

Please sign in to comment.