[libp2p-dns] Implement /dnsaddr resolution. (#1931)

* Implement `/dnsaddr` support on `libp2p-dns`.

To that end, since resolving `/dnsaddr` addresses needs
"fully qualified" multiaddresses when dialing, i.e. those
that end with the `/p2p/...` protocol, we make sure that
dialing always uses such fully qualified addresses by
appending the `/p2p` protocol as necessary. As a side-effect,
this adds support for dialing peers via "fully qualified"
addresses, as an alternative to using a `PeerId` together
with a `Multiaddr` with or without the `/p2p` protocol.

* Adapt libp2p-relay.

* Update versions, changelogs and small cleanups.
This commit is contained in:
Roman Borschel
2021-03-17 10:53:19 +01:00
committed by GitHub
parent c1f75eee81
commit 45f07bf863
57 changed files with 738 additions and 309 deletions

View File

@ -283,9 +283,9 @@ pub async fn development_transport(keypair: identity::Keypair)
{
let transport = {
let tcp = tcp::TcpConfig::new().nodelay(true);
let transport = dns::DnsConfig::system(tcp).await?;
let websockets = websocket::WsConfig::new(transport.clone());
transport.or_transport(websockets)
let dns_tcp = dns::DnsConfig::system(tcp).await?;
let ws_dns_tcp = websocket::WsConfig::new(dns_tcp.clone());
dns_tcp.or_transport(ws_dns_tcp)
};
let noise_keys = noise::Keypair::<noise::X25519Spec>::new()
@ -318,9 +318,9 @@ pub fn tokio_development_transport(keypair: identity::Keypair)
{
let transport = {
let tcp = tcp::TokioTcpConfig::new().nodelay(true);
let transport = dns::TokioDnsConfig::system(tcp)?;
let websockets = websocket::WsConfig::new(transport.clone());
transport.or_transport(websockets)
let dns_tcp = dns::TokioDnsConfig::system(tcp)?;
let ws_dns_tcp = websocket::WsConfig::new(dns_tcp.clone());
dns_tcp.or_transport(ws_dns_tcp)
};
let noise_keys = noise::Keypair::<noise::X25519Spec>::new()