github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/sys_conn_windows.go (about)

     1  //go:build windows
     2  
     3  package quic
     4  
     5  import (
     6  	"net/netip"
     7  	"syscall"
     8  
     9  	"golang.org/x/sys/windows"
    10  )
    11  
    12  func newConn(c OOBCapablePacketConn, supportsDF bool) (*basicConn, error) {
    13  	return &basicConn{PacketConn: c, supportsDF: supportsDF}, nil
    14  }
    15  
    16  func inspectReadBuffer(c syscall.RawConn) (int, error) {
    17  	var size int
    18  	var serr error
    19  	if err := c.Control(func(fd uintptr) {
    20  		size, serr = windows.GetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_RCVBUF)
    21  	}); err != nil {
    22  		return 0, err
    23  	}
    24  	return size, serr
    25  }
    26  
    27  func inspectWriteBuffer(c syscall.RawConn) (int, error) {
    28  	var size int
    29  	var serr error
    30  	if err := c.Control(func(fd uintptr) {
    31  		size, serr = windows.GetsockoptInt(windows.Handle(fd), windows.SOL_SOCKET, windows.SO_SNDBUF)
    32  	}); err != nil {
    33  		return 0, err
    34  	}
    35  	return size, serr
    36  }
    37  
    38  type packetInfo struct {
    39  	addr netip.Addr
    40  }
    41  
    42  func (i *packetInfo) OOB() []byte { return nil }