Browse Source

ipv6: move unexposed error values into helper.go

Change-Id: Iac5121529bb1044e64724937f5d5e2bff8a336a6
Reviewed-on: https://go-review.googlesource.com/16321
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Mikio Hara 10 years ago
parent
commit
4f2fc6c1e6
3 changed files with 8 additions and 10 deletions
  1. 0 7
      ipv6/control.go
  2. 1 2
      ipv6/header.go
  3. 7 1
      ipv6/helper.go

+ 0 - 7
ipv6/control.go

@@ -5,18 +5,11 @@
 package ipv6
 
 import (
-	"errors"
 	"fmt"
 	"net"
 	"sync"
 )
 
-var (
-	errMissingAddress  = errors.New("missing address")
-	errInvalidConnType = errors.New("invalid conn type")
-	errNoSuchInterface = errors.New("no such interface")
-)
-
 // Note that RFC 3542 obsoletes RFC 2292 but OS X Snow Leopard and the
 // former still support RFC 2292 only.  Please be aware that almost
 // all protocol implementations prohibit using a combination of RFC

+ 1 - 2
ipv6/header.go

@@ -5,7 +5,6 @@
 package ipv6
 
 import (
-	"errors"
 	"fmt"
 	"net"
 )
@@ -37,7 +36,7 @@ func (h *Header) String() string {
 // ParseHeader parses b as an IPv6 base header.
 func ParseHeader(b []byte) (*Header, error) {
 	if len(b) < HeaderLen {
-		return nil, errors.New("header too short")
+		return nil, errHeaderTooShort
 	}
 	h := &Header{
 		Version:      int(b[0]) >> 4,

+ 7 - 1
ipv6/helper.go

@@ -9,7 +9,13 @@ import (
 	"net"
 )
 
-var errOpNoSupport = errors.New("operation not supported")
+var (
+	errMissingAddress  = errors.New("missing address")
+	errHeaderTooShort  = errors.New("header too short")
+	errInvalidConnType = errors.New("invalid conn type")
+	errOpNoSupport     = errors.New("operation not supported")
+	errNoSuchInterface = errors.New("no such interface")
+)
 
 func boolint(b bool) int {
 	if b {