github.com/sagernet/quic-go@v0.43.1-beta.1/sys_conn_helper_freebsd.go (about)

     1  //go:build freebsd
     2  
     3  package quic
     4  
     5  import (
     6  	"net/netip"
     7  	"syscall"
     8  
     9  	"golang.org/x/sys/unix"
    10  )
    11  
    12  const (
    13  	msgTypeIPTOS = unix.IP_RECVTOS
    14  	ipv4PKTINFO  = 0x7
    15  )
    16  
    17  const ecnIPv4DataLen = 1
    18  
    19  const batchSize = 8
    20  
    21  func parseIPv4PktInfo(body []byte) (ip netip.Addr, _ uint32, ok bool) {
    22  	// struct in_pktinfo {
    23  	// 	struct in_addr ipi_addr;     /* Header Destination address */
    24  	// };
    25  	if len(body) != 4 {
    26  		return netip.Addr{}, 0, false
    27  	}
    28  	return netip.AddrFrom4(*(*[4]byte)(body)), 0, true
    29  }
    30  
    31  func isGSOEnabled(syscall.RawConn) bool { return false }
    32  
    33  func isECNEnabled() bool { return !isECNDisabledUsingEnv() }