|
|
@ -192,11 +192,27 @@ namespace llarp
|
|
|
|
&& port() == other.port();
|
|
|
|
&& port() == other.port();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
|
|
|
sameAddr(const Addr& other) const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return memcmp(addr6(), other.addr6(), 16) == 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
operator!=(const Addr& other) const
|
|
|
|
operator!=(const Addr& other) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isPrivate()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
in_addr_t addr = this->addr4()->s_addr;
|
|
|
|
|
|
|
|
unsigned byte = ntohl(addr);
|
|
|
|
|
|
|
|
unsigned byte1 = byte >> 24 & 0xff;
|
|
|
|
|
|
|
|
unsigned byte2 = byte >> 16 & 0xff;
|
|
|
|
|
|
|
|
return (byte1 == 10 || (byte1 == 192 && byte2 == 168) || (byte1 == 172 && (byte2 & 0xf0) == 16));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct addrhash
|
|
|
|
struct addrhash
|
|
|
|