Closed aw closed 11 years ago
Maybe this could be determined by looking at the IP address instead of by a boolean?
e.g.
require 'ipaddr'
IPAddr.new('127.0.0.1').ipv4?
We'll need to do a resolve at socket setup time though, if it's a dns name.
Why?
I don't see any advantage in trying to do guesswork on something that is already known. Not to mention the additional overhead and possible issues with yet another dependency.
ipaddr and resolv are in the stdlib. if someone passes a dns name, they do not know if it's ipv4 or ipv6, so I have some problems with the premise "something that is already known".
You're right.
When I have time i'll look into writing an improved patch. Thanks!
Added a 3rd argument to the StatsD initializer, a boolean which we use to specify if our host is an IPv6 address or not.
I chose to strictly specify the type since we don't want to resolve the host to determine if it's an v4 or v6 (and trust me, OS X will damage your brain when you get into that.. something about the default
/etc/hosts
having multiple addresses resolving forlocalhost
, and Ruby choosing::1
as the default forIPSocket.getaddress('localhost')
.. what a pain.. ANYWAYS.Here's a first attempt at enabling it. :ocean:
Usage: