mirror of https://github.com/BTCPrivate/lnd.git
discovery: update DNS bootstrapper to adhere to new query schema
In this commit, we update the DNS bootstrapper to match the new query semantics expected by the new DNS server. We no longer hard code the target DNS host, and instead, we’ll re-use the same target endpoint as we only need the soaShim in order to establish a direct TCP connection for the queries.
This commit is contained in:
parent
6793f3653e
commit
30019538c4
|
@ -278,8 +278,9 @@ func NewDNSSeedBootstrapper(seeds [][2]string, lookupHost func(string) ([]string
|
||||||
// address of the authoritative DNS server. Once we have this IP address, we'll
|
// address of the authoritative DNS server. Once we have this IP address, we'll
|
||||||
// connect manually over TCP to request the SRV record. This is necessary as
|
// connect manually over TCP to request the SRV record. This is necessary as
|
||||||
// the records we return are currently too large for a class of resolvers,
|
// the records we return are currently too large for a class of resolvers,
|
||||||
// causing them to be filtered out.
|
// causing them to be filtered out. The targetEndPoint is the original end
|
||||||
func fallBackSRVLookup(soaShim string) ([]*net.SRV, error) {
|
// point that was meant to be hit.
|
||||||
|
func fallBackSRVLookup(soaShim string, targetEndPoint string) ([]*net.SRV, error) {
|
||||||
log.Tracef("Attempting to query fallback DNS seed")
|
log.Tracef("Attempting to query fallback DNS seed")
|
||||||
|
|
||||||
// First, we'll lookup the IP address of the server that will act as
|
// First, we'll lookup the IP address of the server that will act as
|
||||||
|
@ -297,7 +298,7 @@ func fallBackSRVLookup(soaShim string) ([]*net.SRV, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsHost := "_nodes._tcp.nodes.lightning.directory."
|
dnsHost := fmt.Sprintf("_nodes._tcp.%v", targetEndPoint)
|
||||||
dnsConn := &dns.Conn{Conn: conn}
|
dnsConn := &dns.Conn{Conn: conn}
|
||||||
defer dnsConn.Close()
|
defer dnsConn.Close()
|
||||||
|
|
||||||
|
@ -369,8 +370,10 @@ search:
|
||||||
// If we get an error when trying to query via
|
// If we get an error when trying to query via
|
||||||
// the primary seed, we'll fallback to the
|
// the primary seed, we'll fallback to the
|
||||||
// secondary seed before concluding failure.
|
// secondary seed before concluding failure.
|
||||||
secondarySeed := dnsSeedTuple[1]
|
soaShim := dnsSeedTuple[1]
|
||||||
addrs, err = fallBackSRVLookup(secondarySeed)
|
addrs, err = fallBackSRVLookup(
|
||||||
|
soaShim, primarySeed,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue