MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / startReverseForwardingClient

Method startReverseForwardingClient

agentprotocol/server.go:612–648  ·  view source on GitHub ↗
(setupPacket SetupPacket)

Source from the content-addressed store, hash-verified

610}
611
612func (c *ForwardCtx) startReverseForwardingClient(setupPacket SetupPacket) (chan *Connection, error) {
613 c.init()
614
615 mar, err := cbor.Marshal(&setupPacket)
616 if err != nil {
617 c.logger.Error(message.Wrap(
618 err,
619 message.EAgentDecodingFailed,
620 "Error marshalling setup packet",
621 ))
622 return nil, err
623 }
624
625 packet := Packet{
626 Type: PACKET_SETUP,
627 Payload: mar,
628 }
629 err = c.writePacket(&packet)
630 if err != nil {
631 return nil, err
632 }
633
634 resp := Packet{}
635 err = c.decoder.Decode(&resp)
636 if err != nil {
637 return nil, err
638 }
639 if resp.Type == PACKET_ERROR {
640 return nil, fmt.Errorf("received error packet from client")
641 } else if resp.Type != PACKET_SUCCESS {
642 return nil, fmt.Errorf("received invalid packet from client")
643 }
644
645 go c.handleBackend()
646
647 return c.connectionChannel, nil
648}
649
650func (c *ForwardCtx) StartX11ForwardClient(singleConnection bool, screen string, authProtocol string, authCookie string) (chan *Connection, error) {
651 setupPacket := SetupPacket{

Callers 3

StartX11ForwardClientMethod · 0.95

Calls 8

initMethod · 0.95
writePacketMethod · 0.95
handleBackendMethod · 0.95
WrapFunction · 0.92
MarshalMethod · 0.65
ErrorMethod · 0.65
DecodeMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected