go-ping icon indicating copy to clipboard operation
go-ping copied to clipboard

Add ability to change the ICMP ID and seq counter

Open foogod opened this issue 3 years ago • 1 comments
trafficstars

It is sometimes valuable to be able to change the ICMP echo identifier field (in particular, this is often used by NAT gateways to tie packets to a particular NAT session, and it may not be desirable for all pingers in the same program to be associated wth the same NAT session).

This change exposes the ID as a field in Pinger which can be overridden by the caller (defaults to PID as before). It can actually even be changed while the pinger is running without issues.

Also, since one can now have different pingers with different identifiers, it might be desirable to have them use independent sequence values, so the ability to override the sequence counter used has also been added (since it was easy).

(This change is actually required for some improvements I am working on to the Prometheus ping_exporter..)

foogod avatar Dec 01 '21 01:12 foogod

Is there anything stopping this PR? It would be very useful to have this functionality for ping_exporter.

outofrange avatar Jul 20 '23 15:07 outofrange