Support setting send/receive buffers for the IP sockets

This commit is contained in:
Bolke de Bruin 2020-09-11 22:01:40 +02:00
parent 8876b04466
commit 505eafdc1e
6 changed files with 89 additions and 0 deletions

View file

@ -8,6 +8,8 @@ import (
"io"
"log"
"net"
"os"
"syscall"
)
type RedirectFlags struct {
@ -136,3 +138,11 @@ func receive(data []byte, out net.Conn) {
out.Write(pkt)
}
// wrapSyscallError takes an error and a syscall name. If the error is
// a syscall.Errno, it wraps it in a os.SyscallError using the syscall name.
func wrapSyscallError(name string, err error) error {
if _, ok := err.(syscall.Errno); ok {
err = os.NewSyscallError(name, err)
}
return err
}