aboutsummaryrefslogtreecommitdiff
path: root/ipv4
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2014-11-29 10:11:10 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2014-11-29 10:11:10 +0900
commite93b1edd55e90c6d93b85d6c06b6fa85d18d7476 (patch)
treecf69e3f79ae89e10825f38ac07988d4e4277dcd5 /ipv4
parent3748d8c2fdc5600797e1200ed7ca82358bbeadeb (diff)
downloadnet-e93b1edd55e90c6d93b85d6c06b6fa85d18d7476.tar.gz
x/net/{internal/icmp,ipv4,ipv6}: better method for icmp.Type interface
LGTM=iant R=iant, bradfitz CC=golang-codereviews https://golang.org/cl/173670044
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
+}