~ As a last resort, we do a DNS lookup to the lightning DNS seed to * resolve a node name when they say to connect to it. This is synchronous, * so connectd blocks, but it's not very common so we haven't fixed it. * * This "seed by DNS" approach is similar to what bitcoind uses, and in fact * has the nice property that DNS is cached, and the seed only sees a request * from the ISP, not dire
| 1615 | * has the nice property that DNS is cached, and the seed only sees a request |
| 1616 | * from the ISP, not directly from the user. */ |
| 1617 | static void add_seed_addrs(struct wireaddr_internal **addrs, |
| 1618 | const struct node_id *id, |
| 1619 | struct sockaddr *broken_reply) |
| 1620 | { |
| 1621 | struct wireaddr *new_addrs; |
| 1622 | const char **hostnames = seednames(tmpctx, id); |
| 1623 | |
| 1624 | for (size_t i = 0; i < tal_count(hostnames); i++) { |
| 1625 | status_peer_debug(id, "Resolving %s", hostnames[i]); |
| 1626 | new_addrs = wireaddr_from_hostname(tmpctx, hostnames[i], chainparams_get_ln_port(chainparams), |
| 1627 | NULL, broken_reply, NULL); |
| 1628 | if (new_addrs) { |
| 1629 | for (size_t j = 0; j < tal_count(new_addrs); j++) { |
| 1630 | if (new_addrs[j].type == ADDR_TYPE_DNS) |
| 1631 | continue; |
| 1632 | struct wireaddr_internal a; |
| 1633 | a.itype = ADDR_INTERNAL_WIREADDR; |
| 1634 | a.u.wireaddr = new_addrs[j]; |
| 1635 | status_peer_debug(id, "Resolved %s to %s", hostnames[i], |
| 1636 | type_to_string(tmpctx, struct wireaddr, |
| 1637 | &a.u.wireaddr)); |
| 1638 | tal_arr_expand(addrs, a); |
| 1639 | } |
| 1640 | /* Other seeds will likely have the same information. */ |
| 1641 | return; |
| 1642 | } else |
| 1643 | status_peer_debug(id, "Could not resolve %s", hostnames[i]); |
| 1644 | } |
| 1645 | } |
| 1646 | |
| 1647 | static bool wireaddr_int_equals_wireaddr(const struct wireaddr_internal *addr_a, |
| 1648 | const struct wireaddr *addr_b) |
no test coverage detected