summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/icmp
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-07-20 15:22:49 -0700
committerGitHub <noreply@github.com>2017-07-20 15:22:49 -0700
commit58839cefb50e56ae5b157b37e9814ae83ceee70b (patch)
tree5de966481678096fc9567f74f96673b34a65127c /vendor/golang.org/x/net/icmp
parente2f4492eadb5d3c58606b1fdd5774b63a07c236a (diff)
downloadchat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.gz
chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.tar.bz2
chat-58839cefb50e56ae5b157b37e9814ae83ceee70b.zip
Upgrading server dependancies (#6984)
Diffstat (limited to 'vendor/golang.org/x/net/icmp')
-rw-r--r--vendor/golang.org/x/net/icmp/helper.go27
-rw-r--r--vendor/golang.org/x/net/icmp/ipv4.go9
-rw-r--r--vendor/golang.org/x/net/icmp/ipv4_test.go3
3 files changed, 9 insertions, 30 deletions
diff --git a/vendor/golang.org/x/net/icmp/helper.go b/vendor/golang.org/x/net/icmp/helper.go
deleted file mode 100644
index 6c4e633bc..000000000
--- a/vendor/golang.org/x/net/icmp/helper.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package icmp
-
-import (
- "encoding/binary"
- "unsafe"
-)
-
-var (
- // See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
- freebsdVersion uint32
-
- nativeEndian binary.ByteOrder
-)
-
-func init() {
- i := uint32(1)
- b := (*[4]byte)(unsafe.Pointer(&i))
- if b[0] == 1 {
- nativeEndian = binary.LittleEndian
- } else {
- nativeEndian = binary.BigEndian
- }
-}
diff --git a/vendor/golang.org/x/net/icmp/ipv4.go b/vendor/golang.org/x/net/icmp/ipv4.go
index 729ddc97c..ffc66ed4d 100644
--- a/vendor/golang.org/x/net/icmp/ipv4.go
+++ b/vendor/golang.org/x/net/icmp/ipv4.go
@@ -9,9 +9,14 @@ import (
"net"
"runtime"
+ "golang.org/x/net/internal/socket"
"golang.org/x/net/ipv4"
)
+// freebsdVersion is set in sys_freebsd.go.
+// See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
+var freebsdVersion uint32
+
// ParseIPv4Header parses b as an IPv4 header of ICMP error message
// invoking packet, which is contained in ICMP error message.
func ParseIPv4Header(b []byte) (*ipv4.Header, error) {
@@ -36,12 +41,12 @@ func ParseIPv4Header(b []byte) (*ipv4.Header, error) {
}
switch runtime.GOOS {
case "darwin":
- h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
+ h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4]))
case "freebsd":
if freebsdVersion >= 1000000 {
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))
} else {
- h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
+ h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4]))
}
default:
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))
diff --git a/vendor/golang.org/x/net/icmp/ipv4_test.go b/vendor/golang.org/x/net/icmp/ipv4_test.go
index 47cc00d07..058953f43 100644
--- a/vendor/golang.org/x/net/icmp/ipv4_test.go
+++ b/vendor/golang.org/x/net/icmp/ipv4_test.go
@@ -11,6 +11,7 @@ import (
"runtime"
"testing"
+ "golang.org/x/net/internal/socket"
"golang.org/x/net/ipv4"
)
@@ -55,7 +56,7 @@ var ipv4HeaderLittleEndianTest = ipv4HeaderTest{
func TestParseIPv4Header(t *testing.T) {
tt := &ipv4HeaderLittleEndianTest
- if nativeEndian != binary.LittleEndian {
+ if socket.NativeEndian != binary.LittleEndian {
t.Skip("no test for non-little endian machine yet")
}