golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/ipv6/helper_posix_test.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows || zos 6 7 package ipv6_test 8 9 import ( 10 "errors" 11 "os" 12 "syscall" 13 14 "golang.org/x/net/ipv6" 15 ) 16 17 func protocolNotSupported(err error) bool { 18 switch err := err.(type) { 19 case syscall.Errno: 20 switch err { 21 case syscall.EPROTONOSUPPORT, syscall.ENOPROTOOPT: 22 return true 23 } 24 case *os.SyscallError: 25 switch err := err.Err.(type) { 26 case syscall.Errno: 27 switch err { 28 case syscall.EPROTONOSUPPORT, syscall.ENOPROTOOPT: 29 return true 30 } 31 } 32 } 33 return errors.Is(err, ipv6.ErrNotImplemented) 34 }