Skip to content

IPv6

Created: 2016-02-26 11:43:33 -0800 Modified: 2016-02-29 12:28:19 -0800

Sometimes you’ll see an address like this: ::ffff:192.168.1.10 For example, I got this when I was running Restify in NodeJS and I printed out “req.connection.hostAddress” from a REST route on Linux (the request itself was sent from Windows on the same machine).

I believe the 80-bit prefix of zeroes that’s mentioned on the Wikipedia reference page is denoted by the leading colons.

2/26/2016 - if you’re ever concerned about having to support IPv4 addresses, you can simply encapsulate them in this way so that your application only ever has to deal with IPv6 addresses. In order to do this, you’ll need some way to determine that an incoming address is IPv4.

Just put square brackets around the IPv6 part, e.g. http://[::ffff:192.168.1.21]:8080/health