diff --git a/ipv6/control.go b/ipv6/control.go index 27f1d2f8..8f065aaf 100644 --- a/ipv6/control.go +++ b/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 diff --git a/ipv6/header.go b/ipv6/header.go index 3c38b99c..b842b6b8 100644 --- a/ipv6/header.go +++ b/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, diff --git a/ipv6/helper.go b/ipv6/helper.go index 64934848..4a6f1069 100644 --- a/ipv6/helper.go +++ b/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 {