github.com/problame/go-netssh (go): Minimum Go Version  We require Go 1.11 in order to support deadlines: This package uses two *os.File (stdin, stdout) to implement a net.Conn interface. As such, we need to support deadlines, and Go 1.10 introduced deadlines for certain types of *os.File (https://golang.org/doc/go1.10#os). However, apart from OS/FS constraints, deadlines on *os.File only work if the underlying FD can be added to Go's event pool mechanism, which generally requires the FD to be non-blocking at the time the *os.File is created. This is the case for os.Open and so on, but not for os.Std{in,out,err}, which are created using os.NewFile from the existing FDs 0, 1 and 2. Those are blocking by default, and Go does not change them to non-blocking because the parent process might be a terminal and not expect the tty to change to non-blocking mode after the Go process exits.  Hence, in Go 1.10, deadline operations on os.Std{in,out,err} fail with os.ErrDeadline. Go 1.11 improves the behavior of os.NewFile such that iff the FD passed to os.NewFile is already non-blocking, the *os.File / FD is part of the event loop, which makes deadlines work iff the OS supports it at all (this is the case for stdin, stdout, stderr, which are pipes in our specific use case). See https://github.com/golang/go/issues/24842#issuecomment-381268558  How do we deal with this issue in package netssh? We require Go 1.11 via build tag to get the os.NewFile behavior described above and set os.Std{in,out} to non-blocking before sending it over the unix control socket. See usage of github.com/ftrvxmtrx/fd in functions Proxy and Listener.Accept.
Keywords: golang|network|openssh|ssh|transport