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