aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/icmp
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/icmp')
-rw-r--r--vendor/golang.org/x/net/icmp/endpoint.go13
-rw-r--r--vendor/golang.org/x/net/icmp/listen_stub.go2
-rw-r--r--vendor/golang.org/x/net/icmp/message.go8
-rw-r--r--vendor/golang.org/x/net/icmp/mpls.go4
4 files changed, 13 insertions, 14 deletions
diff --git a/vendor/golang.org/x/net/icmp/endpoint.go b/vendor/golang.org/x/net/icmp/endpoint.go
index a68bfb0..7640a8c 100644
--- a/vendor/golang.org/x/net/icmp/endpoint.go
+++ b/vendor/golang.org/x/net/icmp/endpoint.go
@@ -7,7 +7,6 @@ package icmp
import (
"net"
"runtime"
- "syscall"
"time"
"golang.org/x/net/ipv4"
@@ -47,7 +46,7 @@ func (c *PacketConn) IPv6PacketConn() *ipv6.PacketConn {
// ReadFrom reads an ICMP message from the connection.
func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
if !c.ok() {
- return 0, nil, syscall.EINVAL
+ return 0, nil, errInvalidConn
}
// Please be informed that ipv4.NewPacketConn enables
// IP_STRIPHDR option by default on Darwin.
@@ -64,7 +63,7 @@ func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
// datagram-oriented ICMP endpoint. Otherwise it must be net.IPAddr.
func (c *PacketConn) WriteTo(b []byte, dst net.Addr) (int, error) {
if !c.ok() {
- return 0, syscall.EINVAL
+ return 0, errInvalidConn
}
return c.c.WriteTo(b, dst)
}
@@ -72,7 +71,7 @@ func (c *PacketConn) WriteTo(b []byte, dst net.Addr) (int, error) {
// Close closes the endpoint.
func (c *PacketConn) Close() error {
if !c.ok() {
- return syscall.EINVAL
+ return errInvalidConn
}
return c.c.Close()
}
@@ -89,7 +88,7 @@ func (c *PacketConn) LocalAddr() net.Addr {
// endpoint.
func (c *PacketConn) SetDeadline(t time.Time) error {
if !c.ok() {
- return syscall.EINVAL
+ return errInvalidConn
}
return c.c.SetDeadline(t)
}
@@ -98,7 +97,7 @@ func (c *PacketConn) SetDeadline(t time.Time) error {
// endpoint.
func (c *PacketConn) SetReadDeadline(t time.Time) error {
if !c.ok() {
- return syscall.EINVAL
+ return errInvalidConn
}
return c.c.SetReadDeadline(t)
}
@@ -107,7 +106,7 @@ func (c *PacketConn) SetReadDeadline(t time.Time) error {
// endpoint.
func (c *PacketConn) SetWriteDeadline(t time.Time) error {
if !c.ok() {
- return syscall.EINVAL
+ return errInvalidConn
}
return c.c.SetWriteDeadline(t)
}
diff --git a/vendor/golang.org/x/net/icmp/listen_stub.go b/vendor/golang.org/x/net/icmp/listen_stub.go
index 668728d..14beb0e 100644
--- a/vendor/golang.org/x/net/icmp/listen_stub.go
+++ b/vendor/golang.org/x/net/icmp/listen_stub.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build nacl plan9
+// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
package icmp
diff --git a/vendor/golang.org/x/net/icmp/message.go b/vendor/golang.org/x/net/icmp/message.go
index 46fe95a..4a78017 100644
--- a/vendor/golang.org/x/net/icmp/message.go
+++ b/vendor/golang.org/x/net/icmp/message.go
@@ -18,16 +18,16 @@ import (
"encoding/binary"
"errors"
"net"
- "syscall"
"golang.org/x/net/internal/iana"
"golang.org/x/net/ipv4"
"golang.org/x/net/ipv6"
)
-// BUG(mikio): This package is not implemented on NaCl and Plan 9.
+// BUG(mikio): This package is not implemented on JS, NaCl and Plan 9.
var (
+ errInvalidConn = errors.New("invalid connection")
errMessageTooShort = errors.New("message too short")
errHeaderTooShort = errors.New("header too short")
errBufferTooShort = errors.New("buffer too short")
@@ -80,7 +80,7 @@ func (m *Message) Marshal(psh []byte) ([]byte, error) {
case ipv6.ICMPType:
mtype = int(typ)
default:
- return nil, syscall.EINVAL
+ return nil, errInvalidConn
}
b := []byte{byte(mtype), byte(m.Code), 0, 0}
if m.Type.Protocol() == iana.ProtocolIPv6ICMP && psh != nil {
@@ -143,7 +143,7 @@ func ParseMessage(proto int, b []byte) (*Message, error) {
case iana.ProtocolIPv6ICMP:
m.Type = ipv6.ICMPType(b[0])
default:
- return nil, syscall.EINVAL
+ return nil, errInvalidConn
}
if fn, ok := parseFns[m.Type]; !ok {
m.Body, err = parseDefaultMessageBody(proto, b[4:])
diff --git a/vendor/golang.org/x/net/icmp/mpls.go b/vendor/golang.org/x/net/icmp/mpls.go
index c314917..f9f4841 100644
--- a/vendor/golang.org/x/net/icmp/mpls.go
+++ b/vendor/golang.org/x/net/icmp/mpls.go
@@ -6,7 +6,7 @@ package icmp
import "encoding/binary"
-// A MPLSLabel represents a MPLS label stack entry.
+// MPLSLabel represents an MPLS label stack entry.
type MPLSLabel struct {
Label int // label value
TC int // traffic class; formerly experimental use
@@ -19,7 +19,7 @@ const (
typeIncomingMPLSLabelStack = 1
)
-// A MPLSLabelStack represents a MPLS label stack.
+// MPLSLabelStack represents an MPLS label stack.
type MPLSLabelStack struct {
Class int // extension object class number
Type int // extension object sub-type