Commit Graph

108 Commits

Author SHA1 Message Date
dependabot[bot]
a65f11fd68
Bump golang.org/x/net from 0.15.0 to 0.19.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.15.0 to 0.19.0.
- [Commits](https://github.com/golang/net/compare/v0.15.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-19 09:56:09 +00:00
Kaj J. Niemi
98d1a39fbf
Merge pull request #20 from basen/dependabot/go_modules/github.com/google/uuid-1.5.0
Bump github.com/google/uuid from 1.3.1 to 1.5.0
2023-12-19 11:55:13 +02:00
Kaj J. Niemi
0190d627c4
Merge pull request #17 from basen/dependabot/go_modules/golang.org/x/sync-0.5.0
Bump golang.org/x/sync from 0.3.0 to 0.5.0
2023-12-19 11:54:47 +02:00
dependabot[bot]
b66b61d63c
Bump github.com/google/uuid from 1.3.1 to 1.5.0
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.1 to 1.5.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.1...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-18 23:30:56 +00:00
dependabot[bot]
06ebda74fb
Bump golang.org/x/sync from 0.3.0 to 0.5.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.3.0 to 0.5.0.
- [Commits](https://github.com/golang/sync/compare/v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-11-06 23:22:30 +00:00
Kaj J. Niemi
a4e4b990ba
Merge pull request #12 from basen/dependabot/go_modules/golang.org/x/net-0.15.0
Bump golang.org/x/net from 0.14.0 to 0.15.0
2023-09-12 12:23:43 +03:00
dependabot[bot]
b8f179c9b6
Bump golang.org/x/net from 0.14.0 to 0.15.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.14.0 to 0.15.0.
- [Commits](https://github.com/golang/net/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-11 23:41:13 +00:00
Kaj J. Niemi
f740309aae
Merge pull request #11 from basen/dependabot/go_modules/github.com/google/uuid-1.3.1
Bump github.com/google/uuid from 1.3.0 to 1.3.1
2023-08-28 13:54:28 +03:00
dependabot[bot]
5dd117c3e4
Bump github.com/google/uuid from 1.3.0 to 1.3.1
Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21 23:07:23 +00:00
Kaj J. Niemi
dba794308a
Merge pull request #10 from basen/dependabot/go_modules/golang.org/x/net-0.14.0
Bump golang.org/x/net from 0.12.0 to 0.14.0
2023-08-16 16:03:47 +03:00
Kaj Niemi
b0c2c210c1 add mention of cherry picking 2023-08-16 12:45:26 +00:00
Jeremiah Millay
343775cbaa Return ctx.Err() from RunWithContext() and Run() (#50)
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:43:06 +00:00
Jeremiah Millay
118abe2a50 Add support for OnSendError and OnRecvError handlers (#44)
* Add support for OnSendError and OnRecvError handlers

Signed-off-by: Jeremiah Millay <jmillay@fastly.com>

* do not use handler := pattern for callbacks

Signed-off-by: Jeremiah Millay <jmillay@fastly.com>

---------

Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:42:59 +00:00
Ben Kochie
28dee17585 Remove unnecessary handler allocations (#47)
Cleanup unnecessary creation of `handler` vars for various event
handlers.

Signed-off-by: SuperQ <superq@gmail.com>
2023-08-16 12:42:32 +00:00
Jeremiah Millay
7b2aa2bf3d Add support for setting do-not-fragment bit (linux) (#39)
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:41:22 +00:00
Jeremiah Millay
877239a18a create error type for unsupported SO_MARK socket option
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:40:09 +00:00
Jeremiah Millay
089e6a92cb Workaround unprivileged PacketConn on darwin returns the entire IP packet in icmp.ListenPacket()
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:39:50 +00:00
TheRushingWookie
5e08633e1b Create a Run API with a context object
Signed-off-by: TheRushingWookie <3181551+TheRushingWookie@users.noreply.github.com>
2023-08-16 12:37:44 +00:00
Jeremiah Millay
a4fbe74944 Add support for setting SO_MARK socket option on outgoing ICMP packets
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:36:08 +00:00
TheRushingWookie
a5e239147e Fix datarace in testPacketConnOK by adding a mutex when accessing testPacketConnOK's member variables
Signed-off-by: TheRushingWookie <3181551+TheRushingWookie@users.noreply.github.com>
2023-08-16 12:32:56 +00:00
Jeremiah Millay
31b1b44067 Fix packet loss stat zero division (#51)
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
2023-08-16 12:28:30 +00:00
dependabot[bot]
9e960329a1
Bump golang.org/x/net from 0.12.0 to 0.14.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.12.0 to 0.14.0.
- [Commits](https://github.com/golang/net/compare/v0.12.0...v0.14.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-08-07 23:57:37 +00:00
Kaj J. Niemi
17096581d8
Merge pull request #8 from basen/dependabot/go_modules/golang.org/x/sync-0.3.0 2023-07-13 17:12:56 +03:00
dependabot[bot]
2f4eedb1d6
Bump golang.org/x/sync from 0.2.0 to 0.3.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.2.0 to 0.3.0.
- [Commits](https://github.com/golang/sync/compare/v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-13 14:12:21 +00:00
Kaj J. Niemi
0b3e2694f6
Merge pull request #9 from basen/dependabot/go_modules/golang.org/x/net-0.12.0 2023-07-13 17:11:36 +03:00
dependabot[bot]
136126a27b
Bump golang.org/x/net from 0.10.0 to 0.12.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.12.0.
- [Commits](https://github.com/golang/net/compare/v0.10.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-10 23:20:55 +00:00
Kaj J. Niemi
442eb100c5
Merge pull request #4 from basen/dependabot/go_modules/golang.org/x/sync-0.2.0
Bump golang.org/x/sync from 0.1.0 to 0.2.0
2023-05-17 20:03:03 +03:00
dependabot[bot]
b702988fa6
Bump golang.org/x/sync from 0.1.0 to 0.2.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.1.0 to 0.2.0.
- [Commits](https://github.com/golang/sync/compare/v0.1.0...v0.2.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-17 16:57:13 +00:00
Kaj J. Niemi
c2457fc90d
Merge pull request #5 from basen/dependabot/go_modules/golang.org/x/net-0.10.0
Bump golang.org/x/net from 0.7.0 to 0.10.0
2023-05-17 19:56:34 +03:00
Kaj J. Niemi
ececdc59cf
Merge pull request #6 from go-ping/master
Add deprecation notice to README
2023-05-17 19:56:12 +03:00
dependabot[bot]
76dcbcc416
Bump golang.org/x/net from 0.7.0 to 0.10.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.7.0 to 0.10.0.
- [Commits](https://github.com/golang/net/compare/v0.7.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-09 00:01:59 +00:00
Kaj Niemi
c486a21ad5 get up to date 2023-02-21 15:38:27 +02:00
Kaj Niemi
51f8079108 add dependabot to keep us somewhat up to date 2023-02-21 15:34:46 +02:00
Thomas Casteleyn
caaf2b72ea Add deprecation notice to README 2023-01-21 22:33:18 +00:00
Mika Savela
c939a03fb2 fix tests 2023-01-12 11:34:15 +00:00
Kaj J. Niemi
1c7ace28c4
Merge pull request #1 from basen/tos-support
Add TOS support
2022-09-19 13:08:12 +03:00
Mika Savela
63b43a38b6 Add TOS support 2022-09-19 09:57:36 +00:00
Marcelo Magallon
b89bb75386
Report whether or not the TTL value was read (#205)
In IPv6 a hop limit of 0 is valid, so the TTL the code is reporting is
actually a valid value in that case.

Initialize ttl to -1, so that in the case of not getting a TTL value
from the control message, we can let the rest of the code whether the
reported value was actually 0 or whether it couldn't be read.

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
2022-05-23 16:54:11 +02:00
chenlujjj
6d40342032
Delete redundant pinger.Stop() call (#197) 2022-04-28 15:36:15 +02:00
Marcelo E. Magallon
64d100b308 Goreleaser can no longer be installed using goreleaser.sh
This installation method was deprecated because the associated tool has
been deprecated.

Download "by hand" and run checks before trying to use binary.

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
2022-04-27 09:11:44 +01:00
Charlie Jonas
779d1e9195 Set Packet.ID when sending ICMP requests 2021-11-30 11:55:50 +00:00
Nate Sales
27679364c9 feat: add configurable ICMP identifier 2021-11-30 11:55:50 +00:00
Cemre Mengu
6e2b003bff
Add ability to set TTL (#186) 2021-10-14 19:03:14 +01:00
Ben Kochie
3818264768 Use a UUID for packet tracking
Replace the random 8 byte tracker with a 16 byte UUID.
* Implement as a slice so that it can be extended later.
* Deprecate the exported `Pinger.Tracker` value.

https://github.com/go-ping/ping/issues/142

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-09-11 16:15:12 +01:00
Marcelo Magallon
ff8be33200
Provide an abstraction over icmp.PacketConn (#166)
The differences between IPv4 and IPv6 APIs can be moved to a single type so that we don't need to keep track of them all over the code. We can also split Run() into two parts: the top one sets up the listener and the bottom one sends and receives packets. In this way, the bottom part can be tested using a mock packet connection.
2021-05-07 00:38:00 +01:00
Marcelo Magallon
e4e642a957
Use exponential backoff for read deadline (#162)
Before this change, pinging any target once takes ~ 100 ms (the time it takes for Run() to return, not the RTT). After this change, it takes a time comparable to the RTT. The change comes from ReadFrom blocking for the specified delay if the done signal hasn't fired yet. It also improves a little the time it takes to ping a single target multiple times.

Since this is exponential backoff in the way Ethernet does it (random delay, with an increasing maximum value, only changing in case of a timeout), the delay neither necessarily doubles nor increases each time the operation has to be retried, but it does eventually settle on the higher end of the possibilities if there are many timeouts.

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
Committed-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
Committed-by: Charlie Jonas <charlie@charliejonas.co.uk>
2021-04-07 22:46:46 +01:00
Marcelo Magallon
1726e5ede5
Add Logger interface to avoid logging directly (#161)
This commit adds a simple level-based log interface that allows users of the library to control and customize the output, for example by providing a standard Go logger with different settings (timestamps, prefixes, etc).

Closes #16. Closes #103.

Signed-off-by: Marcelo E. Magallon <marcelo.magallon@grafana.com>
2021-04-03 00:25:49 +01:00
Charlie Jonas
80a5113803
Reorder channel selection order and make Stop() idempotent (#159)
This fixes #94, closes #116 and also closes #157.
2021-03-27 00:20:15 +00:00
Charlie Jonas
01e0869fb9 Wrap errors when using fmt.Errorf 2021-03-26 23:37:49 +00:00
Charlie Jonas
54fa5d1e4a Add size flag to demo pinger
Adds a command line flag to the demo pinger which lets the user set the
the size of the ICMP payload. This is useful for testing. The default is
set at 16 which is the default for an unconfigured pinger.

Signed-off-by: Charlie Jonas <charlie@charliejonas.co.uk>
2021-03-26 23:36:52 +00:00