blob: 3dcb727c95c4c419d829399ef03a282ebc297229 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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
5package nettest
6
7import (
8 "fmt"
9 "runtime"
10 "syscall"
11)
12
13func maxOpenFiles() int {
14 return 4 * defaultMaxOpenFiles /* actually it's 16581375 */
15}
16
17func supportsRawIPSocket() (string, bool) {
18 // From http://msdn.microsoft.com/en-us/library/windows/desktop/ms740548.aspx:
19 // Note: To use a socket of type SOCK_RAW requires administrative privileges.
20 // Users running Winsock applications that use raw sockets must be a member of
21 // the Administrators group on the local computer, otherwise raw socket calls
22 // will fail with an error code of WSAEACCES. On Windows Vista and later, access
23 // for raw sockets is enforced at socket creation. In earlier versions of Windows,
24 // access for raw sockets is enforced during other socket operations.
25 s, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_RAW, 0)
26 if err == syscall.WSAEACCES {
27 return fmt.Sprintf("no access to raw socket allowed on %s", runtime.GOOS), false
28 }
29 if err != nil {
30 return err.Error(), false
31 }
32 syscall.Closesocket(s)
33 return "", true
34}
35
36func supportsIPv6MulticastDeliveryOnLoopback() bool {
37 return true
38}
39
40func causesIPv6Crash() bool {
41 return false
42}