github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/net/internal/nettest/error_posix.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 darwin dragonfly freebsd linux netbsd openbsd solaris windows 6 7 package nettest 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 }