From 687023bdc79e1bd375fd4e30b0c748598c0964c8 Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Tue, 6 Nov 2018 13:47:14 +0100 Subject: [PATCH] Include adddress in Packet (#38) Include the original address in the Packet type for use in `pinger.OnRecv()`. --- ping.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ping.go b/ping.go index a22a926..9792c02 100644 --- a/ping.go +++ b/ping.go @@ -158,6 +158,9 @@ type Packet struct { // IPAddr is the address of the host being pinged. IPAddr *net.IPAddr + // Addr is the string address of the host being pinged. + Addr string + // NBytes is the number of bytes in the message. Nbytes int @@ -436,6 +439,7 @@ func (p *Pinger) processPacket(recv *packet) error { outPkt := &Packet{ Nbytes: recv.nbytes, IPAddr: p.ipaddr, + Addr: p.addr, } switch pkt := m.Body.(type) {