clambin / pinger

Measures the latency and packet loss to one or more hosts and reports the data to Prometheus.
MIT License
2 stars 1 forks source link

Pinging IPv6 addresses stoped working with v1.8.0 #86

Closed riyad closed 1 year ago

riyad commented 1 year ago

After updating my build from 9c1c7c31b3538269cace26d267f2b5ab3e68f970 to 1.8.0 pinging IPv6 addresses stopped working. I downloaded the binary from the GitHub release page and could reproduce the error with it:

# ./pinger-linux-arm 2a01:4f8:c2c:8101::1
INFO[0000] collector started                             hosts="[2a01:4f8:c2c:8101::1]" version=v1.8.0
panic: pinger: 2a01:4f8:c2c:8101::1: address 2a01:4f8:c2c:8101::1:0: too many colons in address

goroutine 1 [running]:
github.com/clambin/pinger/collector/pinger.MustNew(0x19024c0, {0x190d018, 0x1, 0x1})
        /home/runner/work/pinger/pinger/collector/pinger/pinger.go:56 +0xc0
github.com/clambin/pinger/collector.New({0x190d018, 0x1, 0x1})
        /home/runner/work/pinger/pinger/collector/collector.go:23 +0x4c
main.main()
        /home/runner/work/pinger/pinger/cmd/pinger/pinger.go:53 +0x8d4
clambin commented 1 year ago

well ... ouch. :)

Support for IPv6 was really only a byproduct of how it was implemented pre-1.8. So never really tested (I don't run IPv6 myself). Having said that, it worked before, so I better fix it. :)

I reworked v1.8 to (hopefully) support IPv6 (without breaking when IPv6 isn't available). Give v1.8.1-rc1 a spin and see if that works for you.

riyad commented 1 year ago

Hi, I've tried it and IPv6 addresses work again (both with sha-05eebaf and 1.8.1-rc1). :smile:

riyad commented 1 year ago

But now I see a different issue ... :sweat_smile:

If you ping domains AND their IP addresses TOGETHER the domains appear "dead" (i.e. no stats):

# podman run --rm -it -p1234:8080 ghcr.io/clambin/pinger:1.8.1-rc1 --debug www.bilak.info 116.203.176.52
INFO[0000] collector started                             hosts="[www.bilak.info 116.203.176.52]" version=v1.8.1-rc1
DEBU[0000] www.bilak.info resolves to udp4:116.203.176.52:0
DEBU[0000] 116.203.176.52 resolves to udp4:116.203.176.52:0
DEBU[0002]                                               count=0 host=www.bilak.info latency=0s loss=0
DEBU[0002]                                               count=1 host=116.203.176.52 latency=17.241833ms loss=0
DEBU[0005]                                               count=0 host=www.bilak.info latency=0s loss=0
DEBU[0005]                                               count=4 host=116.203.176.52 latency=66.753891ms loss=0
DEBU[0006]                                               count=0 host=www.bilak.info latency=0s loss=0
DEBU[0006]                                               count=0 host=116.203.176.52 latency=0s loss=0
DEBU[0006]                                               count=0 host=www.bilak.info latency=0s loss=0
[...]

Pinging them with separate instances works ... but not together in one. o.O

(This also used to work before v1.8.0 ... e.g. with sha-9c1c7c3)

clambin commented 1 year ago

never would have considered that use case. :) fixed in ghcr.io/clambin/pinger:sha-c97c4d0.

introduces some performance overhead so may tweak it further.

riyad commented 1 year ago

Thank you, it works :smile:

clambin commented 1 year ago

Cool. Thanks for your help. :-)