::ffff:18.234.32.226
is an IPv4 address (18.234.32.226
) mapped as an IPv6 one, which you detect because of the use of :
.
This is a common case that happens on systems configured to prefer IPv6 over IPv4 (something you can configure in Unix systems with the file /etc/gai.conf
).
It is explained in https://www.rfc-editor.org/rfc/rfc3493 section 3.7:
The API also provides a different type of compatibility: the ability
for IPv6 applications to interoperate with IPv4 applications. This
feature uses the IPv4-mapped IPv6 address format defined in the IPv6
addressing architecture specification [2]. This address format
allows the IPv4 address of an IPv4 node to be represented as an IPv6
address. The IPv4 address is encoded into the low-order 32 bits of
the IPv6 address, and the high-order 96 bits hold the fixed prefix
0:0:0:0:0:FFFF. IPv4-mapped addresses are written as follows:
::FFFF:<IPv4-address>
You need either to configure your system not to map IPv4 addresses as IPv6 ones, or use a library that knows how to handle those IP addresses (which are completely legit). Or in the worse case, indeed remove yourself the ::ffff:
at beginning.