[][src]Function libp2p_core::address_translation

pub fn address_translation(
    original: &Multiaddr,
    observed: &Multiaddr
) -> Option<Multiaddr>

Perform IP address translation.

Given an original Multiaddr and some observed Multiaddr, return a translated Multiaddr which has the first IP address translated by the corresponding one from observed.

This is a mixed-mode translation, i.e. an IPv4 address may be replaced by an IPv6 address and vice versa.

If the first [Protocol]s are not IP addresses, None is returned instead.