Commit Graph

73 Commits

Author SHA1 Message Date
Alirie Gray
3eec4c7c0d Add ability to specifiy source IP address 2019-05-29 16:33:37 -07:00
Maximiliano Churichi
5cc5e2921d Fix TTL comment 2019-05-28 15:33:38 -07:00
Clint Armstrong
3745d7b591 expose ttl on returned ping 2019-05-28 15:33:38 -07:00
Cameron Sparr
ef3ab45e41
Don't oversend packets
fixes part of #6
2018-11-06 16:54:34 +00:00
Ben Kochie
3a0b5a7d8e Fix CPU use (#40)
* Move default case out of select block.
* Add defers to close resources.
* `go fmt` cleanup.
2018-11-06 16:04:36 +00:00
Cameron Sparr
9db3df4bca
Set a random source seed to avoid ID conflicts
closes #14
closes #33
2018-11-06 14:30:27 +00:00
Lincoln Thurlow
28a88d0810 patch: compare identifier for non-root access icmp (#32)
Commit d046b245 introduces a bug which causes ping to always fail.
The source of this bug is:

```
	// Check if reply from same ID
	body := m.Body.(*icmp.Echo)
	if body.ID != p.id {
		return nil
	}
```

Which due to the selection of p.id requires that SetPrivileged is
set to true.  In the case where Privileged (i.e p.network == udp)
it is left to the kernel to set the ICMP id.

https://lwn.net/Articles/443051/  Discusses the introduction of
non-setuid-less ping.  The kernel implementation for this
interface dictates using the local port, which gets mapped into
the ping_table struct.  There is no current implementation in the
go icmp library to address this problem directly.

To address this issue, I've added a `Tracker` field for `Pinger`
as well as `IcmpData` datastructure to allow for uniquely tracking
icmp requests.  The id (as with the `id` field) is not unique,
but will statistically rare for duplicates.
2018-11-06 14:10:49 +00:00
Ben Kochie
687023bdc7 Include adddress in Packet (#38)
Include the original address in the Packet type for use in
`pinger.OnRecv()`.
2018-11-06 12:47:14 +00:00
Cameron Sparr
74b9e0e9f9
Update sample code, README, and circle v2 (#42)
Update sample code, README, and circle v2
2018-11-06 12:45:58 +00:00
Xie Zhenye
667d0a66f2 remove signal handler, add Stop method (#10)
* remove signal handler, add Stop method

* Added ICMP Packet ID to distinguish ICMP replies
2018-11-06 10:48:48 +00:00
Maciek Szczesniak
ad2f544f6b Removed duplicated fields in struct (#27) 2018-08-30 17:03:48 +01:00
webfrank
d046b24518 Added ICMP Packet ID to distinguish ICMP replies in multithreading environment (#15) 2018-08-29 18:21:50 +01:00
keeZey
5740bb1ff1 Change size to Size to make it exportable (#18)
I have made Size exportable as i require the ability to change the
packetsize on a per host basis
2018-08-29 18:14:37 +01:00
mapl
68a45b48a0 Update README.md (#21)
update doc on windows support
2018-08-29 18:10:52 +01:00
Cameron Sparr
416e72114c Add integration tests in circle 2016-02-08 09:29:08 -07:00
Cameron Sparr
dae25ab260 Write unit tests 2016-02-07 14:15:39 -07:00
Cameron Sparr
f1680c8931 put setcap command in README 2016-02-03 11:39:07 -07:00
Cameron Sparr
8ee98d82c4 fix sysctl command 2016-02-01 16:50:38 -07:00
Cameron Sparr
88cc1ad8dd uncommit ping binary 2016-02-01 15:52:45 -07:00
Cameron Sparr
3d295adf56 README typos 2016-02-01 15:49:19 -07:00
Cameron Sparr
3535a0e9a0 Update doc on privileged ping and install 2016-02-01 15:28:30 -07:00
Cameron Sparr
77403bd6ed First commit of go-ping library 2016-02-01 15:21:12 -07:00
Cameron Sparr
5b436d0265 Initial commit 2016-02-01 15:06:45 -07:00