github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/net/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 // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows zos 7 8 package ipv6_test 9 10 import ( 11 "os" 12 "syscall" 13 ) 14 15 func protocolNotSupported(err error) bool { 16 switch err := err.(type) { 17 case syscall.Errno: 18 switch err { 19 case syscall.EPROTONOSUPPORT, syscall.ENOPROTOOPT: 20 return true 21 } 22 case *os.SyscallError: 23 switch err := err.Err.(type) { 24 case syscall.Errno: 25 switch err { 26 case syscall.EPROTONOSUPPORT, syscall.ENOPROTOOPT: 27 return true 28 } 29 } 30 } 31 return false 32 }