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
7package ipv4_test
8
9import (
10	"os"
11	"syscall"
12)
13
14func 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}
32