stack_unix.go 511 B

12345678910111213141516171819202122
  1. // Copyright 2015 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. // +build darwin dragonfly freebsd linux netbsd openbsd solaris
  5. package nettest
  6. import (
  7. "fmt"
  8. "os"
  9. "runtime"
  10. )
  11. // SupportsRawIPSocket reports whether the platform supports raw IP
  12. // sockets.
  13. func SupportsRawIPSocket() (string, bool) {
  14. if os.Getuid() != 0 {
  15. return fmt.Sprintf("must be root on %s", runtime.GOOS), false
  16. }
  17. return "", true
  18. }