code: func proxyIO(clients <-chan net.Conn, tty *os.File, ttyFailure chan<- error) {
  	ec := make(chan error)
  
  	// ttyToRemote copies output from application TTY to remote client.
  	// If copier reaches TTY EOF, it hard-fails and propagates the error up.
  	ttyToRemote := func(dst net.Conn, src *os.File) {
  		_, err := io.Copy(dst, src)
  		if err == nil {
  			_ = dst.Close()
  			close(ec)
  		}
  	}
  
  	// remoteToTTY copies input from remote client to application TTY.
  	// When copying stops/fails, it recovers and just closes this connection.
  	remoteToTTY := func(dst *os.File, src net.Conn) {
  		io.Copy(dst, src)
  		src.Close()
  	}
  
  	for {
  		select {
  		// a new remote client
  		case cl := <-clients:
  			go ttyToRemote(cl, tty)
  			go remoteToTTY(tty, cl)
  
  		// a TTY failure from one of the copier
  		case tf := <-ec:
  			ttyFailure <- tf
  			return
  		}
  	}
  }
docs: // proxyIO performs bi-directional byte-by-byte forwarding
  // TODO(lucab): this may become line-buffered and muxed to logs
  // TODO(lucab): reset terminal state on new attach