MCPcopy Create free account
hub / github.com/mscdex/ssh2 / openssh_forwardedStreamLocal

Method openssh_forwardedStreamLocal

lib/protocol/Protocol.js:1641–1674  ·  view source on GitHub ↗
(chan, initWindow, maxPacket, cfg)

Source from the content-addressed store, hash-verified

1639 sendPacket(this, this._packetRW.write.finalize(packet));
1640 }
1641 openssh_forwardedStreamLocal(chan, initWindow, maxPacket, cfg) {
1642 if (!this._server)
1643 throw new Error('Server-only method called in client mode');
1644
1645 const pathLen = Buffer.byteLength(cfg.socketPath);
1646 let p = this._packetRW.write.allocStart;
1647 const packet = this._packetRW.write.alloc(
1648 1 + 4 + 33 + 4 + 4 + 4 + 4 + pathLen + 4
1649 );
1650
1651 packet[p] = MESSAGE.CHANNEL_OPEN;
1652
1653 writeUInt32BE(packet, 33, ++p);
1654 packet.utf8Write('forwarded-streamlocal@openssh.com', p += 4, 33);
1655
1656 writeUInt32BE(packet, chan, p += 33);
1657
1658 writeUInt32BE(packet, initWindow, p += 4);
1659
1660 writeUInt32BE(packet, maxPacket, p += 4);
1661
1662 writeUInt32BE(packet, pathLen, p += 4);
1663 packet.utf8Write(cfg.socketPath, p += 4, pathLen);
1664
1665 writeUInt32BE(packet, 0, p += pathLen);
1666
1667 if (this._debug) {
1668 this._debug(
1669 'Outbound: Sending CHANNEL_OPEN '
1670 + `(r:${chan}, forwarded-streamlocal@openssh.com)`
1671 );
1672 }
1673 sendPacket(this, this._packetRW.write.finalize(packet));
1674 }
1675 exitStatus(chan, status) {
1676 if (!this._server)
1677 throw new Error('Server-only method called in client mode');

Callers 1

openChannelFunction · 0.80

Calls 3

writeUInt32BEFunction · 0.85
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected