Source File
ip_gro_linux.go
Belonging Package
github.com/tmc/go-iroh/internal/socket
//go:build linuxpackage socketimport ()// enableGRO turns on UDP_GRO so one recvmsg can return many coalesced// datagrams from the same peer.func enableGRO( *net.UDPConn) bool {, := .SyscallConn()if != nil {return false}var errorif := .Control(func( uintptr) {= unix.SetsockoptInt(int(), unix.IPPROTO_UDP, unix.UDP_GRO, 1)}); != nil {return false}return == nil}const groOOBSize = 64// groSegmentSize returns the UDP_GRO segment size in oob, or 0.func groSegmentSize( []byte) int {for len() > 0 {, , , := unix.ParseOneSocketControlMessage()if != nil {return 0}if .Level == unix.IPPROTO_UDP && .Type == unix.UDP_GRO && len() >= 4 {return int(int32(binary.NativeEndian.Uint32()))}=}return 0}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |