MCPcopy
hub / github.com/nirui/sshwifty / local

Method local

application/commands/ssh.go:570–702  ·  view source on GitHub ↗
(
	f *command.FSM,
	r *rw.LimitedReader,
	h command.StreamHeader,
	b []byte,
)

Source from the content-addressed store, hash-verified

568}
569
570func (d *sshClient) local(
571 f *command.FSM,
572 r *rw.LimitedReader,
573 h command.StreamHeader,
574 b []byte,
575) error {
576 switch h.Marker() {
577 case SSHClientStdIn:
578 remote, remoteErr := d.getRemote()
579
580 if remoteErr != nil {
581 return remoteErr
582 }
583
584 for !r.Completed() {
585 rData, rErr := r.Buffered()
586
587 if rErr != nil {
588 return rErr
589 }
590
591 _, wErr := remote.writer.Write(rData)
592
593 if wErr != nil {
594 d.l.Debug("Failed to write data to remote: %s", wErr)
595 }
596
597 return nil
598 }
599
600 return nil
601
602 case SSHClientResize:
603 remote, remoteErr := d.getRemote()
604
605 if remoteErr != nil {
606 return remoteErr
607 }
608
609 _, rErr := io.ReadFull(r, b[:4])
610
611 if rErr != nil {
612 return rErr
613 }
614
615 rows := int(b[0])
616 rows <<= 8
617 rows |= int(b[1])
618
619 cols := int(b[2])
620 cols <<= 8
621 cols |= int(b[3])
622
623 // It's ok for it to fail
624 wcErr := remote.session.WindowChange(rows, cols)
625
626 if wcErr != nil {
627 d.l.Debug("Failed to resize to %d, %d: %s", rows, cols, wcErr)

Callers

nothing calls this directly

Calls 8

getRemoteMethod · 0.95
FetchOneByteFunction · 0.92
MarkerMethod · 0.80
CompletedMethod · 0.80
BufferedMethod · 0.80
RemainsMethod · 0.80
WriteMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected