From 5bf6f7ec592f53ccd7bf999496eee4a09020e93c Mon Sep 17 00:00:00 2001 From: Tatsushi Demachi Date: Thu, 23 Jul 2015 23:31:02 +0900 Subject: [PATCH] Remove golang.org/x/net/internal/iana dependency Since Go 1.5, internal package rule (see https://golang.org/s/go14internal for more details) applies to GOPATH packages. It prevents this package from loading iana package and causes package building failure. This fixes it by adding its own ICMP protocol constants and removing iana package dependency. Fix #10 --- fastping.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fastping.go b/fastping.go index eaaa952..3bb23cb 100644 --- a/fastping.go +++ b/fastping.go @@ -48,12 +48,15 @@ import ( "time" "golang.org/x/net/icmp" - "golang.org/x/net/internal/iana" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" ) -const TimeSliceLength = 8 +const ( + TimeSliceLength = 8 + ProtocolICMP = 1 + ProtocolIPv6ICMP = 58 +) var ( ipv4Proto = map[string]string{"ip": "ip4:icmp", "udp": "udp4"} @@ -586,10 +589,10 @@ func (p *Pinger) procRecv(recv *packet, queue map[string]*net.IPAddr) { } else { bytes = recv.bytes } - proto = iana.ProtocolICMP + proto = ProtocolICMP } else if isIPv6(ipaddr.IP) { bytes = recv.bytes - proto = iana.ProtocolIPv6ICMP + proto = ProtocolIPv6ICMP } else { return }