diff --git a/ping.go b/ping.go index f2e23d1..00bd42f 100644 --- a/ping.go +++ b/ping.go @@ -152,6 +152,9 @@ type Pinger struct { // rtts is all of the Rtts rtts []time.Duration + // OnSetup is called when Pinger has finished setting up the listening socket + OnSetup func() + // OnSend is called when Pinger sends a packet OnSend func(*Packet) @@ -400,6 +403,10 @@ func (p *Pinger) Run() error { //nolint:errcheck go p.recvICMP(conn, recv, &wg) + if handler := p.OnSetup; handler != nil { + handler() + } + err = p.sendICMP(conn) if err != nil { return err