#3 - DNS support + IPv6
This commit is contained in:
@@ -15,7 +15,18 @@ QuicrPeerLink::QuicrPeerLink(uint32_t self_id, uint16_t port)
|
||||
{}
|
||||
|
||||
void QuicrPeerLink::connect_to(uint32_t peer_id, const tw::net::Address& addr) {
|
||||
auto r = m_endpoint->connect(net::quicr::QuicrAddress(addr.ip_string(), addr.port()));
|
||||
// The address is rebuilt from its text, which for a mapped or IPv6 peer is
|
||||
// more than the literal constructor can parse, so it goes back through the
|
||||
// resolver — into the endpoint's family, since that is what will send it.
|
||||
auto address_r = net::quicr::QuicrAddress::resolve(addr.ip_string(), addr.port(),
|
||||
m_endpoint->family());
|
||||
if (!address_r) {
|
||||
spdlog::warn("QuicrPeerLink[{}]: address of peer {} failed to resolve: {}",
|
||||
m_self_id, peer_id, address_r.error().message());
|
||||
return;
|
||||
}
|
||||
|
||||
auto r = m_endpoint->connect(address_r.value());
|
||||
if (!r) {
|
||||
spdlog::warn("QuicrPeerLink[{}]: connect to peer {} failed", m_self_id, peer_id);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user