aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/net/icmp/endpoint.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/icmp/endpoint.go')
-rw-r--r--vendor/golang.org/x/net/icmp/endpoint.go13
1 files changed, 6 insertions, 7 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)
}