1// Copyright 2019 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 6 7package nettest 8 9import "syscall" 10 11func supportsRawSocket() bool { 12 for _, af := range []int{syscall.AF_INET, syscall.AF_INET6} { 13 s, err := syscall.Socket(af, syscall.SOCK_RAW, 0) 14 if err != nil { 15 continue 16 } 17 syscall.Close(s) 18 return true 19 } 20 return false 21} 22