aboutsummaryrefslogtreecommitdiff
path: root/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'ipv4')
-rw-r--r--ipv4/icmp.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipv4/icmp.go b/ipv4/icmp.go
index d595967..4682e8c 100644
--- a/ipv4/icmp.go
+++ b/ipv4/icmp.go
@@ -4,6 +4,8 @@
package ipv4
+import "golang.org/x/net/internal/iana"
+
// An ICMPType represents a type of ICMP message.
type ICMPType int
@@ -14,3 +16,8 @@ func (typ ICMPType) String() string {
}
return s
}
+
+// Protocol returns the ICMPv4 protocol number.
+func (typ ICMPType) Protocol() int {
+ return iana.ProtocolICMP
+}