github.com/quic-go/quic-go@v0.44.0/integrationtests/self/self_suite_linux_test.go (about)

     1  //go:build linux
     2  
     3  package self_test
     4  
     5  import (
     6  	"errors"
     7  	"os"
     8  
     9  	"golang.org/x/sys/unix"
    10  )
    11  
    12  // The first sendmsg call on a new UDP socket sometimes errors on Linux.
    13  // It's not clear why this happens.
    14  // See https://github.com/golang/go/issues/63322.
    15  func isPermissionError(err error) bool {
    16  	var serr *os.SyscallError
    17  	if errors.As(err, &serr) {
    18  		return serr.Syscall == "sendmsg" && serr.Err == unix.EPERM
    19  	}
    20  	return false
    21  }