1
0
mirror of https://github.com/taigrr/go-fastping synced 2025-01-18 05:03:15 -08:00

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
This commit is contained in:
Tatsushi Demachi 2015-07-23 23:31:02 +09:00
parent d19ff13e39
commit 5bf6f7ec59

View File

@ -48,12 +48,15 @@ import (
"time" "time"
"golang.org/x/net/icmp" "golang.org/x/net/icmp"
"golang.org/x/net/internal/iana"
"golang.org/x/net/ipv4" "golang.org/x/net/ipv4"
"golang.org/x/net/ipv6" "golang.org/x/net/ipv6"
) )
const TimeSliceLength = 8 const (
TimeSliceLength = 8
ProtocolICMP = 1
ProtocolIPv6ICMP = 58
)
var ( var (
ipv4Proto = map[string]string{"ip": "ip4:icmp", "udp": "udp4"} 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 { } else {
bytes = recv.bytes bytes = recv.bytes
} }
proto = iana.ProtocolICMP proto = ProtocolICMP
} else if isIPv6(ipaddr.IP) { } else if isIPv6(ipaddr.IP) {
bytes = recv.bytes bytes = recv.bytes
proto = iana.ProtocolIPv6ICMP proto = ProtocolIPv6ICMP
} else { } else {
return return
} }