github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/syscall/windows/net_windows.go (about)

     1  // Copyright 2021 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  package windows
     6  
     7  import (
     8  	"sync"
     9  	"syscall"
    10  	_ "unsafe"
    11  )
    12  
    13  //go:linkname WSASendtoInet4 syscall.wsaSendtoInet4
    14  //go:noescape
    15  func WSASendtoInet4(s syscall.Handle, bufs *syscall.WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *syscall.SockaddrInet4, overlapped *syscall.Overlapped, croutine *byte) (err error)
    16  
    17  //go:linkname WSASendtoInet6 syscall.wsaSendtoInet6
    18  //go:noescape
    19  func WSASendtoInet6(s syscall.Handle, bufs *syscall.WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *syscall.SockaddrInet6, overlapped *syscall.Overlapped, croutine *byte) (err error)
    20  
    21  const (
    22  	SIO_TCP_INITIAL_RTO                    = syscall.IOC_IN | syscall.IOC_VENDOR | 17
    23  	TCP_INITIAL_RTO_UNSPECIFIED_RTT        = ^uint16(0)
    24  	TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS = ^uint8(1)
    25  )
    26  
    27  type TCP_INITIAL_RTO_PARAMETERS struct {
    28  	Rtt                   uint16
    29  	MaxSynRetransmissions uint8
    30  }
    31  
    32  var Support_TCP_INITIAL_RTO_NO_SYN_RETRANSMISSIONS = sync.OnceValue(func() bool {
    33  	var maj, min, build uint32
    34  	rtlGetNtVersionNumbers(&maj, &min, &build)
    35  	return maj >= 10 && build&0xffff >= 16299
    36  })
    37  
    38  //go:linkname rtlGetNtVersionNumbers syscall.rtlGetNtVersionNumbers
    39  //go:noescape
    40  func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32)