Skip to content

Commit

Permalink
fixup! Fix merge conflicts with discv5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane committed Jan 6, 2024
1 parent 308d793 commit d22647b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rpc/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,12 @@ impl Payload for Response {
let mut ip = [0u8; 16];
ip.copy_from_slice(&ip_bytes);
let ipv6 = Ipv6Addr::from(ip);
// If the ipv6 is ipv4 compatible/mapped, simply return the ipv4.
if let Some(ipv4) = ipv6.to_ipv4() {
if ipv6.is_loopback() {
// Checking if loopback address since IPv6Addr::to_ipv4 returns
// IPv4 address for IPv6 loopback address.
IpAddr::V6(ipv6)
} else if let Some(ipv4) = ipv6.to_ipv4() {
// If the ipv6 is ipv4 compatible/mapped, simply return the ipv4.
IpAddr::V4(ipv4)
} else {
IpAddr::V6(ipv6)
Expand Down

0 comments on commit d22647b

Please sign in to comment.