2021-08-23 16:49:22 +02:00
|
|
|
// Package quicx contains lucas-clemente/quic-go extensions.
|
|
|
|
package quicx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// UDPLikeConn is a net.PacketConn with some extra functions
|
|
|
|
// required to convince the QUIC library (lucas-clemente/quic-go)
|
|
|
|
// to inflate the receive buffer of the connection.
|
|
|
|
//
|
|
|
|
// The QUIC library will treat this connection as a "dumb"
|
|
|
|
// net.PacketConn, calling its ReadFrom and WriteTo methods
|
2021-09-29 20:21:25 +02:00
|
|
|
// as opposed to more efficient methods that are available
|
|
|
|
// under Linux and (maybe?) FreeBSD.
|
2021-08-23 16:49:22 +02:00
|
|
|
//
|
|
|
|
// It seems fine to avoid performance optimizations, because
|
|
|
|
// they would complicate the implementation on our side and
|
|
|
|
// our use cases (blocking and heavy throttling) do not seem
|
|
|
|
// to require such optimizations.
|
|
|
|
//
|
|
|
|
// See https://github.com/ooni/probe/issues/1754 for a more
|
|
|
|
// comprehensive discussion of UDPLikeConn.
|
|
|
|
type UDPLikeConn interface {
|
|
|
|
// An UDPLikeConn is a net.PacketConn conn.
|
|
|
|
net.PacketConn
|
|
|
|
|
|
|
|
// SetReadBuffer allows setting the read buffer.
|
|
|
|
SetReadBuffer(bytes int) error
|
|
|
|
|
|
|
|
// SyscallConn returns a conn suitable for calling syscalls,
|
|
|
|
// which is also instrumental to setting the read buffer.
|
|
|
|
SyscallConn() (syscall.RawConn, error)
|
|
|
|
}
|