Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/github/statsd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class UDPClient
attr_reader :sock

def initialize(address, port = nil)
address, port = address.split(':') if address.include?(':')
address, port = address.split(':') if address.count(':') == 1
addrinfo = Addrinfo.ip(address)

@sock = UDPSocket.new(addrinfo.pfamily)
Expand Down
11 changes: 11 additions & 0 deletions spec/statsd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ class << @statsd
statsd = GitHub::Statsd.new(FakeUDPSocket)
statsd.client_class.must_equal FakeUDPSocket
end

it "should allow literal IPv6 addresses" do
[
'0000:0000:0000:0000:0000:0000:0000:0001',
'::1'
].each do |ipv6_addr|
statsd = GitHub::Statsd.new
statsd.add_shard ipv6_addr, 8125
statsd.shards.first.sock.addr[0].must_equal 'AF_INET6'
end
end
end

describe "#increment" do
Expand Down