Categorygithub.com/EdgeCast/icmpengine
modulepackage
1.0.1
Repository: https://github.com/edgecast/icmpengine.git
Documentation: pkg.go.dev

# README

ICMPEngine

ICMPengine is a small library for sending non-privilged ICMP echo requests and recieving replies.

Key features include:

Although this is designed to be used as a library, a basic implmentation is demonstrated here: ./cmd/icmpengine/icmpengine.go

sudo sysctl -w net.ipv4.ping_group_range="0 2147483647"
xtcp diagram

Dependency licenses

DependancyLicenseLink
GolangBSDhttps://golang.org/LICENSE
github.com/go-cmd/cmd v1.3.0MIThttps://github.com/go-cmd/cmd/blob/master/LICENSE
github.com/go-kit/kit v0.10.0MIThttps://github.com/go-kit/kit/blob/master/LICENSE
github.com/hashicorp/go-hclog v0.16.2MIThttps://github.com/hashicorp/go-hclog/blob/master/LICENSE
github.com/pkg/profile v1.6.0BSDhttps://github.com/pkg/profile/blob/master/LICENSE
github.com/prometheus/client_golang v1.11.0Apache 2.0https://github.com/prometheus/client_golang/blob/master/LICENSE
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985BSDhttps://golang.org/LICENSE
inet.af/netaddr v0.0.0-20210721214506-ce7a8ad02cc1BSD-3https://pkg.go.dev/inet.af/netaddr?tab=licenses
das@das-dell5580:~/go/src/gitlab.edgecastcdn.net/dseddon/icmpengine$ cat go.mod 
module gitlab.edgecastcdn.net/dseddon/icmpengine

go 1.16

require (
	github.com/go-cmd/cmd v1.3.0
	github.com/go-kit/kit v0.10.0 // indirect
	github.com/hashicorp/go-hclog v0.16.2
	github.com/pkg/profile v1.6.0
	github.com/prometheus/client_golang v1.11.0
	golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985
	inet.af/netaddr v0.0.0-20210721214506-ce7a8ad02cc1
)

How to tag

git tag
git tag -a v1.0.1 -m "v1.0.1"
git push origin --tags

# Functions

FakeDrop is a simple function to return true based on a probability Looking at this issue, I'm not sure if this is perfect, but should be ok https://github.com/golang/go/issues/12290.
GetDebugLevels is a little helper function to return DebugLevelsT filled in with the same debug level for each component.
New creates ICMPEngine with default Receivers Per Protocol.
NewFullConfig creates ICMPEngine with the full set of configuration options Please note could icmpEngine.Start() It is recommended NOT to actually start until you really need ICMPengine listening for incoming packets e.g.
ParseICMPEchoReply parses the ICMP echo reply messages This was originally based on on the the golang standard icmp ParseMessage, which for unknown reasons don't parse ICMP echo https://pkg.go.dev/golang.org/x/net/icmp#ParseMessage https://github.com/golang/net/blob/7fd8e65b6420/icmp/message.go#L139.
ParseICMPEchoReplyBB is the same as ParseICMPEchoReply, except uses bytes.Buffer, instead of []byte This is mostly to allow use of sync.Pool, which should be faster (maybe?) https://www.akshaydeo.com/blog/2017/12/23/How-did-I-improve-latency-by-700-percent-using-syncPool/.
WriteTo performs the socket write, and does error handling.

# Constants

No description provided by the author
No description provided by the author
Enabled reports if the race detector is enabled.
No description provided by the author
No description provided by the author
No description provided by the author
Internet Control Message.
ICMP for IPv6.
No description provided by the author
max packet receive size.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
ICMPEchoReply represents Echo Reply messages per the IPv4/rfc792 and IPv6/rfc2463 ( see extended comments below ).
ICMPEngine holds the object state Most of this data is for tracking ICMP echo requests sent, and their expiry times The double linked-list (DLL) allows tracking the next Expiry time, while allowing entries to be removed efficently when a ping is recieved.
No description provided by the author
No description provided by the author
PingExpired is passed from the Expirer to the Pingers This only happens when there is a timeout (obviously).
No description provided by the author
PingSuccess is passed from the Receivers to the Pingers.
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author