@zukhruf/ssh 0.0.0-stage → 0.8.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1123 -2
- package/dist/address.d.ts +8 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +15 -0
- package/dist/address.js.map +1 -0
- package/dist/agent.d.ts +35 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +288 -0
- package/dist/agent.js.map +1 -0
- package/dist/channel-stream.d.ts +16 -0
- package/dist/channel-stream.d.ts.map +1 -0
- package/dist/channel-stream.js +102 -0
- package/dist/channel-stream.js.map +1 -0
- package/dist/client.d.ts +114 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +587 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +255 -0
- package/dist/config.js.map +1 -0
- package/dist/control/control-client.d.ts +12 -0
- package/dist/control/control-client.d.ts.map +1 -0
- package/dist/control/control-client.js +156 -0
- package/dist/control/control-client.js.map +1 -0
- package/dist/control/control-master.d.ts +12 -0
- package/dist/control/control-master.d.ts.map +1 -0
- package/dist/control/control-master.js +101 -0
- package/dist/control/control-master.js.map +1 -0
- package/dist/control/control-stream.d.ts +29 -0
- package/dist/control/control-stream.d.ts.map +1 -0
- package/dist/control/control-stream.js +54 -0
- package/dist/control/control-stream.js.map +1 -0
- package/dist/control/messages.d.ts +38 -0
- package/dist/control/messages.d.ts.map +1 -0
- package/dist/control/messages.js +92 -0
- package/dist/control/messages.js.map +1 -0
- package/dist/control/serve-dial.d.ts +11 -0
- package/dist/control/serve-dial.d.ts.map +1 -0
- package/dist/control/serve-dial.js +47 -0
- package/dist/control/serve-dial.js.map +1 -0
- package/dist/control/serve-session.d.ts +11 -0
- package/dist/control/serve-session.d.ts.map +1 -0
- package/dist/control/serve-session.js +78 -0
- package/dist/control/serve-session.js.map +1 -0
- package/dist/control/wire.d.ts +41 -0
- package/dist/control/wire.d.ts.map +1 -0
- package/dist/control/wire.js +100 -0
- package/dist/control/wire.js.map +1 -0
- package/dist/control.d.ts +4 -0
- package/dist/control.d.ts.map +1 -0
- package/dist/control.js +4 -0
- package/dist/control.js.map +1 -0
- package/dist/dial-route.d.ts +14 -0
- package/dist/dial-route.d.ts.map +1 -0
- package/dist/dial-route.js +87 -0
- package/dist/dial-route.js.map +1 -0
- package/dist/host-key-algorithms.d.ts +7 -0
- package/dist/host-key-algorithms.d.ts.map +1 -0
- package/dist/host-key-algorithms.js +16 -0
- package/dist/host-key-algorithms.js.map +1 -0
- package/dist/host-key-policy.d.ts +22 -0
- package/dist/host-key-policy.d.ts.map +1 -0
- package/dist/host-key-policy.js +72 -0
- package/dist/host-key-policy.js.map +1 -0
- package/dist/identities.d.ts +18 -0
- package/dist/identities.d.ts.map +1 -0
- package/dist/identities.js +81 -0
- package/dist/identities.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/knownhosts.d.ts +33 -0
- package/dist/knownhosts.d.ts.map +1 -0
- package/dist/knownhosts.js +241 -0
- package/dist/knownhosts.js.map +1 -0
- package/dist/match-pattern.d.ts +3 -0
- package/dist/match-pattern.d.ts.map +1 -0
- package/dist/match-pattern.js +18 -0
- package/dist/match-pattern.js.map +1 -0
- package/dist/private-key.d.ts +42 -0
- package/dist/private-key.d.ts.map +1 -0
- package/dist/private-key.js +100 -0
- package/dist/private-key.js.map +1 -0
- package/dist/prompt.d.ts +6 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +2 -0
- package/dist/prompt.js.map +1 -0
- package/dist/proxy-command.d.ts +33 -0
- package/dist/proxy-command.d.ts.map +1 -0
- package/dist/proxy-command.js +121 -0
- package/dist/proxy-command.js.map +1 -0
- package/dist/proxy-jump.d.ts +19 -0
- package/dist/proxy-jump.d.ts.map +1 -0
- package/dist/proxy-jump.js +63 -0
- package/dist/proxy-jump.js.map +1 -0
- package/dist/public-key.d.ts +22 -0
- package/dist/public-key.d.ts.map +1 -0
- package/dist/public-key.js +102 -0
- package/dist/public-key.js.map +1 -0
- package/dist/remote-listener.d.ts +14 -0
- package/dist/remote-listener.d.ts.map +1 -0
- package/dist/remote-listener.js +39 -0
- package/dist/remote-listener.js.map +1 -0
- package/dist/server-alive-check.d.ts +36 -0
- package/dist/server-alive-check.d.ts.map +1 -0
- package/dist/server-alive-check.js +103 -0
- package/dist/server-alive-check.js.map +1 -0
- package/dist/server.d.ts +114 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +460 -0
- package/dist/server.js.map +1 -0
- package/dist/session.d.ts +97 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +193 -0
- package/dist/session.js.map +1 -0
- package/dist/ssh-g.d.ts +19 -0
- package/dist/ssh-g.d.ts.map +1 -0
- package/dist/ssh-g.js +67 -0
- package/dist/ssh-g.js.map +1 -0
- package/dist/ssh2-agent-forwarding.d.ts +51 -0
- package/dist/ssh2-agent-forwarding.d.ts.map +1 -0
- package/dist/ssh2-agent-forwarding.js +56 -0
- package/dist/ssh2-agent-forwarding.js.map +1 -0
- package/dist/ssh2-channel-open-failure.d.ts +28 -0
- package/dist/ssh2-channel-open-failure.d.ts.map +1 -0
- package/dist/ssh2-channel-open-failure.js +35 -0
- package/dist/ssh2-channel-open-failure.js.map +1 -0
- package/dist/ssh2-keepalive-request.d.ts +31 -0
- package/dist/ssh2-keepalive-request.d.ts.map +1 -0
- package/dist/ssh2-keepalive-request.js +6 -0
- package/dist/ssh2-keepalive-request.js.map +1 -0
- package/dist/ssh2-server-channel.d.ts +63 -0
- package/dist/ssh2-server-channel.d.ts.map +1 -0
- package/dist/ssh2-server-channel.js +309 -0
- package/dist/ssh2-server-channel.js.map +1 -0
- package/package.json +75 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-jump.d.ts","sourceRoot":"","sources":["../src/proxy-jump.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,WAAW,GAAG;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAKD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,CAoBnD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,SAAS,MAAM,EAAE,GAC7B,MAAM,EAAE,CAOV"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** The options of OpenSSH's ssh that take an argument (`getopt` in ssh.c of OpenSSH 9.6p1 and 10.5p1). */
|
|
2
|
+
const optionsWithArgument = new Set('BDEFIJLOPQRSWbceilmopw');
|
|
3
|
+
/**
|
|
4
|
+
* The jump hosts of the ProxyJump value that ssh -G prints, in order, each
|
|
5
|
+
* with the user and the port that the value gives (`parse_jump` in
|
|
6
|
+
* readconf.c and `parse_user_host_port` in misc.c of OpenSSH 10.5p1).
|
|
7
|
+
*/
|
|
8
|
+
export function parseProxyJump(value) {
|
|
9
|
+
return value.split(',').map((spec) => {
|
|
10
|
+
const uri = spec.startsWith('ssh://');
|
|
11
|
+
let rest = uri ? spec.slice('ssh://'.length).replace(/\/$/, '') : spec;
|
|
12
|
+
const at = rest.lastIndexOf('@');
|
|
13
|
+
let user = at === -1 ? undefined : rest.slice(0, at);
|
|
14
|
+
if (uri && user !== undefined) {
|
|
15
|
+
user = decodeURIComponent(user.split(';')[0] ?? '');
|
|
16
|
+
}
|
|
17
|
+
rest = rest.slice(at + 1);
|
|
18
|
+
const bracket = rest.startsWith('[') ? rest.indexOf(']') : -1;
|
|
19
|
+
const hostEnd = bracket === -1 ? rest.indexOf(':') : bracket + 1;
|
|
20
|
+
const host = hostEnd === -1 ? rest : rest.slice(0, hostEnd);
|
|
21
|
+
const port = hostEnd === -1 ? '' : rest.slice(hostEnd + 1);
|
|
22
|
+
return {
|
|
23
|
+
host: host.replace(/^\[(.*)\]$/, '$1'),
|
|
24
|
+
user,
|
|
25
|
+
port: port === '' ? undefined : Number(port),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The flags of the ssh that OpenSSH starts for a jump host (ssh.c of OpenSSH
|
|
31
|
+
* 10.5p1, lines 1292-1340): `-l` and `-p` from the ProxyJump value, and the
|
|
32
|
+
* caller's `-F <file>` when it gave one. No other flag of the caller.
|
|
33
|
+
*/
|
|
34
|
+
export function jumpHostFlags(hop, callerFlags) {
|
|
35
|
+
const file = configFile(callerFlags);
|
|
36
|
+
return [
|
|
37
|
+
...(hop.user === undefined ? [] : ['-l', hop.user]),
|
|
38
|
+
...(hop.port === undefined ? [] : ['-p', String(hop.port)]),
|
|
39
|
+
...(file === undefined ? [] : ['-F', file]),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
/** The last `-F` of the flags, read as ssh's getopt reads them: `-F file`, `-Ffile`, or at the end of a group such as `-qF file`. */
|
|
43
|
+
function configFile(flags) {
|
|
44
|
+
let file;
|
|
45
|
+
for (let index = 0; index < flags.length; index++) {
|
|
46
|
+
const flag = flags[index] ?? '';
|
|
47
|
+
if (flag === '--')
|
|
48
|
+
break;
|
|
49
|
+
if (!flag.startsWith('-'))
|
|
50
|
+
continue;
|
|
51
|
+
for (let letter = 1; letter < flag.length; letter++) {
|
|
52
|
+
const option = flag.charAt(letter);
|
|
53
|
+
if (!optionsWithArgument.has(option))
|
|
54
|
+
continue;
|
|
55
|
+
const argument = letter + 1 < flag.length ? flag.slice(letter + 1) : flags[++index];
|
|
56
|
+
if (option === 'F')
|
|
57
|
+
file = argument;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
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AAC;AACJ,CAAC;AAED,qIAAqI;AACrI,SAAS,UAAU,CAAC,KAAwB;IAC1C,IAAI,IAAwB,CAAC;IAC7B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChC,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM;QACzB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACpC,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;YACpD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACnC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC;gBAAE,SAAS;YAC/C,MAAM,QAAQ,GACZ,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;YACrE,IAAI,MAAM,KAAK,GAAG;gBAAE,IAAI,GAAG,QAAQ,CAAC;YACpC,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Go's ssh.PublicKey. */
|
|
2
|
+
export declare class PublicKey {
|
|
3
|
+
/** Such as ssh-ed25519. */
|
|
4
|
+
readonly type: string;
|
|
5
|
+
/** Go's Marshal. */
|
|
6
|
+
readonly wire: Uint8Array;
|
|
7
|
+
private constructor();
|
|
8
|
+
/** The wire form, RFC 4253 §6.6. Go's ParsePublicKey. */
|
|
9
|
+
static parse(wire: Uint8Array): PublicKey;
|
|
10
|
+
/** A line of authorized_keys or of a .pub file. Go's ParseAuthorizedKey. */
|
|
11
|
+
static parseAuthorizedKey(line: string): {
|
|
12
|
+
readonly key: PublicKey;
|
|
13
|
+
readonly comment: string;
|
|
14
|
+
readonly options: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
/** SHA256:<base64>, as ssh-keygen -l prints it. Go's FingerprintSHA256. */
|
|
17
|
+
fingerprint(): string;
|
|
18
|
+
equals(other: PublicKey): boolean;
|
|
19
|
+
/** <type> <base64>, as a line of authorized_keys. Go's MarshalAuthorizedKey. */
|
|
20
|
+
toString(): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=public-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-key.d.ts","sourceRoot":"","sources":["../src/public-key.ts"],"names":[],"mappings":"AAIA,0BAA0B;AAC1B,qBAAa,SAAS;IACpB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B,OAAO;IAKP,yDAAyD;IACzD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS;IAmBzC,4EAA4E;IAC5E,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;QACvC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;KACrC;IAYD,2EAA2E;IAC3E,WAAW,IAAI,MAAM;IAKrB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO;IAIjC,gFAAgF;IAChF,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { hash } from 'node:crypto';
|
|
2
|
+
import ssh2 from 'ssh2';
|
|
3
|
+
/** Go's ssh.PublicKey. */
|
|
4
|
+
export class PublicKey {
|
|
5
|
+
/** Such as ssh-ed25519. */
|
|
6
|
+
type;
|
|
7
|
+
/** Go's Marshal. */
|
|
8
|
+
wire;
|
|
9
|
+
constructor(type, wire) {
|
|
10
|
+
this.type = type;
|
|
11
|
+
this.wire = wire;
|
|
12
|
+
}
|
|
13
|
+
/** The wire form, RFC 4253 §6.6. Go's ParsePublicKey. */
|
|
14
|
+
static parse(wire) {
|
|
15
|
+
const bytes = Buffer.from(wire);
|
|
16
|
+
const typeLength = bytes.length >= 4 ? bytes.readUInt32BE(0) : -1;
|
|
17
|
+
if (typeLength < 1 || 4 + typeLength > bytes.length) {
|
|
18
|
+
throw new Error('ssh: the public key has no key type');
|
|
19
|
+
}
|
|
20
|
+
const type = bytes.toString('latin1', 4, 4 + typeLength);
|
|
21
|
+
const parsed = ssh2.utils.parseKey(`${type} ${bytes.toString('base64')}`);
|
|
22
|
+
if (Error.isError(parsed)) {
|
|
23
|
+
throw new Error(`ssh: cannot parse the ${type} public key`, {
|
|
24
|
+
cause: parsed,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (!parsed.getPublicSSH().equals(bytes)) {
|
|
28
|
+
throw new Error(`ssh: the ${type} public key has trailing data`);
|
|
29
|
+
}
|
|
30
|
+
return new PublicKey(type, new Uint8Array(bytes));
|
|
31
|
+
}
|
|
32
|
+
/** A line of authorized_keys or of a .pub file. Go's ParseAuthorizedKey. */
|
|
33
|
+
static parseAuthorizedKey(line) {
|
|
34
|
+
const text = line.trim();
|
|
35
|
+
const parsed = parseKeyFields(text);
|
|
36
|
+
if (parsed !== undefined)
|
|
37
|
+
return { ...parsed, options: [] };
|
|
38
|
+
const { options, rest } = splitOptions(text);
|
|
39
|
+
const withOptions = parseKeyFields(rest);
|
|
40
|
+
if (withOptions === undefined) {
|
|
41
|
+
throw new Error('ssh: no key found in the authorized_keys line');
|
|
42
|
+
}
|
|
43
|
+
return { ...withOptions, options };
|
|
44
|
+
}
|
|
45
|
+
/** SHA256:<base64>, as ssh-keygen -l prints it. Go's FingerprintSHA256. */
|
|
46
|
+
fingerprint() {
|
|
47
|
+
const digest = hash('sha256', this.wire, 'base64');
|
|
48
|
+
return `SHA256:${digest.replace(/=+$/, '')}`;
|
|
49
|
+
}
|
|
50
|
+
equals(other) {
|
|
51
|
+
return Buffer.from(this.wire).equals(other.wire);
|
|
52
|
+
}
|
|
53
|
+
/** <type> <base64>, as a line of authorized_keys. Go's MarshalAuthorizedKey. */
|
|
54
|
+
toString() {
|
|
55
|
+
return `${this.type} ${Buffer.from(this.wire).toString('base64')}`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** `<type> <base64> [comment]`, or undefined when the text does not start with a key. */
|
|
59
|
+
function parseKeyFields(text) {
|
|
60
|
+
const [type, blob, ...comment] = text.split(/[ \t]+/);
|
|
61
|
+
if (type === undefined || blob === undefined)
|
|
62
|
+
return undefined;
|
|
63
|
+
try {
|
|
64
|
+
const key = PublicKey.parse(Buffer.from(blob, 'base64'));
|
|
65
|
+
if (key.type !== type)
|
|
66
|
+
return undefined;
|
|
67
|
+
return { key, comment: comment.join(' ') };
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** The options of an authorized_keys line end at the first space or tab outside quotes. */
|
|
74
|
+
function splitOptions(text) {
|
|
75
|
+
const options = [];
|
|
76
|
+
let option = '';
|
|
77
|
+
let quoted = false;
|
|
78
|
+
for (let index = 0; index < text.length; index++) {
|
|
79
|
+
const character = text[index];
|
|
80
|
+
if (character === '\\' && quoted && text[index + 1] === '"') {
|
|
81
|
+
option += '\\"';
|
|
82
|
+
index++;
|
|
83
|
+
}
|
|
84
|
+
else if (character === '"') {
|
|
85
|
+
quoted = !quoted;
|
|
86
|
+
option += character;
|
|
87
|
+
}
|
|
88
|
+
else if (!quoted && character === ',') {
|
|
89
|
+
options.push(option);
|
|
90
|
+
option = '';
|
|
91
|
+
}
|
|
92
|
+
else if (!quoted && (character === ' ' || character === '\t')) {
|
|
93
|
+
options.push(option);
|
|
94
|
+
return { options, rest: text.slice(index).trim() };
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
option += character;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { options: [], rest: text };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=public-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-key.js","sourceRoot":"","sources":["../src/public-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,0BAA0B;AAC1B,MAAM,OAAO,SAAS;IACpB,2BAA2B;IAClB,IAAI,CAAS;IACtB,oBAAoB;IACX,IAAI,CAAa;IAE1B,YAAoB,IAAY,EAAE,IAAgB;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,yDAAyD;IACzD,MAAM,CAAC,KAAK,CAAC,IAAgB;QAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,IAAI,UAAU,GAAG,CAAC,IAAI,CAAC,GAAG,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YACpD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,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,EAAE,CAAC;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,SAAS,KAAK,IAAI,IAAI,MAAM,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAC5D,MAAM,IAAI,KAAK,CAAC;YAChB,KAAK,EAAE,CAAC;QACV,CAAC;aAAM,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YAC7B,MAAM,GAAG,CAAC,MAAM,CAAC;YACjB,MAAM,IAAI,SAAS,CAAC;QACtB,CAAC;aAAM,IAAI,CAAC,MAAM,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,MAAM,GAAG,EAAE,CAAC;QACd,CAAC;aAAM,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,IAAI,CAAC,EAAE,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,SAAS,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A listener whose close() runs `cancel` once. Not in the API: Client.listen calls it. */
|
|
2
|
+
export declare function createRemoteListener(network: 'tcp' | 'unix', address: string, cancel: () => Promise<void>): RemoteListener;
|
|
3
|
+
/** A socket that the server listens on for the client. */
|
|
4
|
+
export declare class RemoteListener implements AsyncDisposable {
|
|
5
|
+
#private;
|
|
6
|
+
readonly network: 'tcp' | 'unix';
|
|
7
|
+
/** For port 0, the port that the server chose. */
|
|
8
|
+
readonly address: string;
|
|
9
|
+
private constructor();
|
|
10
|
+
/** cancel-tcpip-forward or cancel-streamlocal-forward@openssh.com. A later call waits for the same cancel. */
|
|
11
|
+
close(): Promise<void>;
|
|
12
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=remote-listener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-listener.d.ts","sourceRoot":"","sources":["../src/remote-listener.ts"],"names":[],"mappings":"AAkBA,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,KAAK,GAAG,MAAM,EACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC1B,cAAc,CAEhB;AAED,0DAA0D;AAC1D,qBAAa,cAAe,YAAW,eAAe;;IAMpD,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAGzB,OAAO;IAgBP,8GAA8G;IAC9G,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Future } from '@zukhruf/async';
|
|
2
|
+
const bridge = {
|
|
3
|
+
construct: () => {
|
|
4
|
+
throw new Error('ssh: the RemoteListener class has not loaded');
|
|
5
|
+
},
|
|
6
|
+
};
|
|
7
|
+
/** A listener whose close() runs `cancel` once. Not in the API: Client.listen calls it. */
|
|
8
|
+
export function createRemoteListener(network, address, cancel) {
|
|
9
|
+
return bridge.construct(network, address, cancel);
|
|
10
|
+
}
|
|
11
|
+
/** A socket that the server listens on for the client. */
|
|
12
|
+
export class RemoteListener {
|
|
13
|
+
static {
|
|
14
|
+
bridge.construct = (network, address, cancel) => new RemoteListener(network, address, cancel);
|
|
15
|
+
}
|
|
16
|
+
network;
|
|
17
|
+
/** For port 0, the port that the server chose. */
|
|
18
|
+
address;
|
|
19
|
+
#phase;
|
|
20
|
+
constructor(network, address, cancel) {
|
|
21
|
+
this.network = network;
|
|
22
|
+
this.address = address;
|
|
23
|
+
this.#phase = {
|
|
24
|
+
close: () => {
|
|
25
|
+
const cancelled = Future.run(cancel);
|
|
26
|
+
this.#phase = { close: () => cancelled.wait() };
|
|
27
|
+
return cancelled.wait();
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** cancel-tcpip-forward or cancel-streamlocal-forward@openssh.com. A later call waits for the same cancel. */
|
|
32
|
+
close() {
|
|
33
|
+
return this.#phase.close();
|
|
34
|
+
}
|
|
35
|
+
[Symbol.asyncDispose]() {
|
|
36
|
+
return this.close();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=remote-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-listener.js","sourceRoot":"","sources":["../src/remote-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAMxC,MAAM,MAAM,GAMR;IACF,SAAS,EAAE,GAAG,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;CACF,CAAC;AAEF,2FAA2F;AAC3F,MAAM,UAAU,oBAAoB,CAClC,OAAuB,EACvB,OAAe,EACf,MAA2B;IAE3B,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,0DAA0D;AAC1D,MAAM,OAAO,cAAc;IACzB;QACE,MAAM,CAAC,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAC9C,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,CAAC;IAEQ,OAAO,CAAiB;IACjC,kDAAkD;IACzC,OAAO,CAAS;IACzB,MAAM,CAAQ;IAEd,YACE,OAAuB,EACvB,OAAe,EACf,MAA2B;QAE3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG;YACZ,KAAK,EAAE,GAAG,EAAE;gBACV,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;gBACrC,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;gBAChD,OAAO,SAAS,CAAC,IAAI,EAAE,CAAC;YAC1B,CAAC;SACF,CAAC;IACJ,CAAC;IAED,8GAA8G;IAC9G,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;IAED,CAAC,MAAM,CAAC,YAAY,CAAC;QACnB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Duplex } from 'node:stream';
|
|
2
|
+
import type { Clock } from '@zukhruf/async';
|
|
3
|
+
/**
|
|
4
|
+
* OpenSSH's ServerAliveInterval and ServerAliveCountMax, on a clock
|
|
5
|
+
* (OpenSSH 10.0p1, clientloop.c and packet.c):
|
|
6
|
+
*
|
|
7
|
+
* - The check is due `interval` after the start of the connection
|
|
8
|
+
* (clientloop.c:client_loop calls schedule_server_alive_check) and after
|
|
9
|
+
* each arrival of data from the server
|
|
10
|
+
* (clientloop.c:client_process_net_input calls it before it reads).
|
|
11
|
+
* - Each arrival of data sets the count of checks with no answer to zero
|
|
12
|
+
* (packet.c:ssh_packet_read_poll_seqnr, at each packet). The answer to a
|
|
13
|
+
* keepalive is data, so it resets the count as well
|
|
14
|
+
* (clientloop.c:client_global_request_reply).
|
|
15
|
+
* - A due check adds one to the count. When the count is then above
|
|
16
|
+
* `countMax`, the connection ends; otherwise the check sends
|
|
17
|
+
* keepalive@openssh.com with want reply, and the next check is due
|
|
18
|
+
* `interval` later (clientloop.c:server_alive_check).
|
|
19
|
+
*
|
|
20
|
+
* OpenSSH reads the time of the next check when poll() returns
|
|
21
|
+
* (clientloop.c:client_wait_until_can_do_something); one timer of the clock
|
|
22
|
+
* does it here, and a data arrival only moves the time, as OpenSSH does.
|
|
23
|
+
*/
|
|
24
|
+
export declare class ServerAliveCheck {
|
|
25
|
+
#private;
|
|
26
|
+
/** Starts the check on `transport`, the stream from the server. `send` sends a keepalive request; `timeout` ends the connection. */
|
|
27
|
+
constructor(clock: Clock, keepalive: {
|
|
28
|
+
readonly interval: number;
|
|
29
|
+
readonly countMax: number;
|
|
30
|
+
}, transport: Duplex, send: () => void, timeout: () => void);
|
|
31
|
+
ref(): void;
|
|
32
|
+
unref(): void;
|
|
33
|
+
/** Stops the timer and stops reading the arrivals of data. */
|
|
34
|
+
stop(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=server-alive-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-alive-check.d.ts","sourceRoot":"","sources":["../src/server-alive-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAgB;;IAgB3B,oIAAoI;gBAElI,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EACnE,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,IAAI,EAChB,OAAO,EAAE,MAAM,IAAI;IAsCrB,GAAG,IAAI,IAAI;IAKX,KAAK,IAAI,IAAI;IAKb,8DAA8D;IAC9D,IAAI,IAAI,IAAI;CAIb"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// The longest delay that a timer of Node.js holds; a longer one fires at once.
|
|
2
|
+
const TIMER_MAX = 2 ** 31 - 1;
|
|
3
|
+
/**
|
|
4
|
+
* OpenSSH's ServerAliveInterval and ServerAliveCountMax, on a clock
|
|
5
|
+
* (OpenSSH 10.0p1, clientloop.c and packet.c):
|
|
6
|
+
*
|
|
7
|
+
* - The check is due `interval` after the start of the connection
|
|
8
|
+
* (clientloop.c:client_loop calls schedule_server_alive_check) and after
|
|
9
|
+
* each arrival of data from the server
|
|
10
|
+
* (clientloop.c:client_process_net_input calls it before it reads).
|
|
11
|
+
* - Each arrival of data sets the count of checks with no answer to zero
|
|
12
|
+
* (packet.c:ssh_packet_read_poll_seqnr, at each packet). The answer to a
|
|
13
|
+
* keepalive is data, so it resets the count as well
|
|
14
|
+
* (clientloop.c:client_global_request_reply).
|
|
15
|
+
* - A due check adds one to the count. When the count is then above
|
|
16
|
+
* `countMax`, the connection ends; otherwise the check sends
|
|
17
|
+
* keepalive@openssh.com with want reply, and the next check is due
|
|
18
|
+
* `interval` later (clientloop.c:server_alive_check).
|
|
19
|
+
*
|
|
20
|
+
* OpenSSH reads the time of the next check when poll() returns
|
|
21
|
+
* (clientloop.c:client_wait_until_can_do_something); one timer of the clock
|
|
22
|
+
* does it here, and a data arrival only moves the time, as OpenSSH does.
|
|
23
|
+
*/
|
|
24
|
+
export class ServerAliveCheck {
|
|
25
|
+
#clock;
|
|
26
|
+
#interval;
|
|
27
|
+
#countMax;
|
|
28
|
+
#transport;
|
|
29
|
+
#send;
|
|
30
|
+
#timeout;
|
|
31
|
+
#onData = () => {
|
|
32
|
+
this.#due = this.#clock.performance.now() + this.#interval;
|
|
33
|
+
this.#unanswered = 0;
|
|
34
|
+
};
|
|
35
|
+
#due;
|
|
36
|
+
#unanswered = 0;
|
|
37
|
+
#hold = refTimer;
|
|
38
|
+
#timer;
|
|
39
|
+
/** Starts the check on `transport`, the stream from the server. `send` sends a keepalive request; `timeout` ends the connection. */
|
|
40
|
+
constructor(clock, keepalive, transport, send, timeout) {
|
|
41
|
+
this.#clock = clock;
|
|
42
|
+
this.#interval = keepalive.interval;
|
|
43
|
+
this.#countMax = keepalive.countMax;
|
|
44
|
+
this.#transport = transport;
|
|
45
|
+
this.#send = send;
|
|
46
|
+
this.#timeout = timeout;
|
|
47
|
+
this.#due = clock.performance.now() + keepalive.interval;
|
|
48
|
+
transport.on('data', this.#onData);
|
|
49
|
+
this.#timer = this.#arm();
|
|
50
|
+
}
|
|
51
|
+
#arm() {
|
|
52
|
+
const left = this.#due - this.#clock.performance.now();
|
|
53
|
+
const timer = this.#clock.setTimeout(() => this.#fire(), Math.min(Math.max(left, 0), TIMER_MAX));
|
|
54
|
+
this.#hold(timer);
|
|
55
|
+
return timer;
|
|
56
|
+
}
|
|
57
|
+
#fire() {
|
|
58
|
+
const now = this.#clock.performance.now();
|
|
59
|
+
if (now >= this.#due) {
|
|
60
|
+
this.#unanswered += 1;
|
|
61
|
+
if (this.#unanswered > this.#countMax) {
|
|
62
|
+
this.stop();
|
|
63
|
+
this.#timeout();
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.#send();
|
|
67
|
+
this.#due = now + this.#interval;
|
|
68
|
+
}
|
|
69
|
+
this.#timer = this.#arm();
|
|
70
|
+
}
|
|
71
|
+
ref() {
|
|
72
|
+
this.#hold = refTimer;
|
|
73
|
+
refTimer(this.#timer);
|
|
74
|
+
}
|
|
75
|
+
unref() {
|
|
76
|
+
this.#hold = unrefTimer;
|
|
77
|
+
unrefTimer(this.#timer);
|
|
78
|
+
}
|
|
79
|
+
/** Stops the timer and stops reading the arrivals of data. */
|
|
80
|
+
stop() {
|
|
81
|
+
this.#clock.clearTimeout(this.#timer);
|
|
82
|
+
this.#transport.off('data', this.#onData);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// A timer of the clock is opaque (@zukhruf/async Clock): the timer of Node.js
|
|
86
|
+
// and of @sinonjs/fake-timers has ref() and unref().
|
|
87
|
+
function isHolder(timer) {
|
|
88
|
+
return (typeof timer === 'object' &&
|
|
89
|
+
timer !== null &&
|
|
90
|
+
'ref' in timer &&
|
|
91
|
+
typeof timer.ref === 'function' &&
|
|
92
|
+
'unref' in timer &&
|
|
93
|
+
typeof timer.unref === 'function');
|
|
94
|
+
}
|
|
95
|
+
function refTimer(timer) {
|
|
96
|
+
if (isHolder(timer))
|
|
97
|
+
timer.ref();
|
|
98
|
+
}
|
|
99
|
+
function unrefTimer(timer) {
|
|
100
|
+
if (isHolder(timer))
|
|
101
|
+
timer.unref();
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=server-alive-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-alive-check.js","sourceRoot":"","sources":["../src/server-alive-check.ts"],"names":[],"mappings":"AAIA,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,gBAAgB;IAClB,MAAM,CAAQ;IACd,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,KAAK,CAAa;IAClB,QAAQ,CAAa;IACrB,OAAO,GAAG,GAAS,EAAE;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3D,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC;IACF,IAAI,CAAS;IACb,WAAW,GAAG,CAAC,CAAC;IAChB,KAAK,GAA6B,QAAQ,CAAC;IAC3C,MAAM,CAAU;IAEhB,oIAAoI;IACpI,YACE,KAAY,EACZ,SA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.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Duplex, type Readable, Writable } from 'node:stream';
|
|
2
|
+
import { type PrivateKey } from './private-key.ts';
|
|
3
|
+
import type { Prompt } from './prompt.ts';
|
|
4
|
+
import { PublicKey } from './public-key.ts';
|
|
5
|
+
import { type SignalName, type TerminalModes, type WindowSize } from './session.ts';
|
|
6
|
+
/** Go's ssh.ServerConfig. No clock: the server waits on no timer, and the signal of ServerConn.handshake bounds a slow handshake. */
|
|
7
|
+
export interface ServerConfig {
|
|
8
|
+
readonly hostKeys: readonly PrivateKey[];
|
|
9
|
+
/** Go's PublicKeyCallback. */
|
|
10
|
+
readonly publicKey?: (user: string, key: PublicKey) => boolean | Promise<boolean>;
|
|
11
|
+
/** Go's PasswordCallback. */
|
|
12
|
+
readonly password?: (user: string, password: string) => boolean | Promise<boolean>;
|
|
13
|
+
/** Go's KeyboardInteractiveCallback. */
|
|
14
|
+
readonly keyboardInteractive?: (user: string, ask: (prompts: readonly Prompt[]) => Promise<readonly string[]>) => boolean | Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
export type IncomingChannel = {
|
|
17
|
+
readonly type: 'session';
|
|
18
|
+
accept(): ServerSession;
|
|
19
|
+
reject(): void;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: 'direct-tcpip';
|
|
22
|
+
readonly address: string;
|
|
23
|
+
readonly origin: string;
|
|
24
|
+
accept(): Duplex;
|
|
25
|
+
reject(): void;
|
|
26
|
+
} | {
|
|
27
|
+
readonly type: 'direct-streamlocal@openssh.com';
|
|
28
|
+
readonly path: string;
|
|
29
|
+
accept(): Duplex;
|
|
30
|
+
reject(): void;
|
|
31
|
+
};
|
|
32
|
+
export type GlobalRequest = {
|
|
33
|
+
readonly type: 'tcpip-forward';
|
|
34
|
+
readonly address: string;
|
|
35
|
+
/** port: the port that the server bound, when the address asked for port 0 (RFC 4254 §7.1). */
|
|
36
|
+
accept(port?: number): void;
|
|
37
|
+
reject(): void;
|
|
38
|
+
} | {
|
|
39
|
+
readonly type: 'cancel-tcpip-forward';
|
|
40
|
+
readonly address: string;
|
|
41
|
+
accept(): void;
|
|
42
|
+
reject(): void;
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: 'streamlocal-forward@openssh.com' | 'cancel-streamlocal-forward@openssh.com';
|
|
45
|
+
readonly path: string;
|
|
46
|
+
accept(): void;
|
|
47
|
+
reject(): void;
|
|
48
|
+
};
|
|
49
|
+
export type SessionRequest = {
|
|
50
|
+
readonly type: 'env';
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly value: string;
|
|
53
|
+
accept(): void;
|
|
54
|
+
reject(): void;
|
|
55
|
+
} | {
|
|
56
|
+
readonly type: 'pty-req';
|
|
57
|
+
readonly term: string;
|
|
58
|
+
readonly size: WindowSize;
|
|
59
|
+
readonly modes: TerminalModes;
|
|
60
|
+
accept(): void;
|
|
61
|
+
reject(): void;
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: 'window-change';
|
|
64
|
+
readonly size: WindowSize;
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: 'signal';
|
|
67
|
+
readonly name: SignalName | `${string}@${string}`;
|
|
68
|
+
} | {
|
|
69
|
+
readonly type: 'exec';
|
|
70
|
+
readonly command: string;
|
|
71
|
+
accept(): void;
|
|
72
|
+
reject(): void;
|
|
73
|
+
} | {
|
|
74
|
+
readonly type: 'shell' | 'auth-agent-req@openssh.com';
|
|
75
|
+
accept(): void;
|
|
76
|
+
reject(): void;
|
|
77
|
+
};
|
|
78
|
+
/** The server side of one connection, after its handshake. Go's ssh.ServerConn. */
|
|
79
|
+
export declare class ServerConn implements AsyncDisposable {
|
|
80
|
+
#private;
|
|
81
|
+
readonly user: string;
|
|
82
|
+
readonly clientVersion: string;
|
|
83
|
+
private constructor();
|
|
84
|
+
/** Go's ssh.NewServerConn. */
|
|
85
|
+
static handshake(transport: Duplex, config: ServerConfig, options?: {
|
|
86
|
+
readonly signal?: AbortSignal;
|
|
87
|
+
}): Promise<ServerConn>;
|
|
88
|
+
/** Go's <-chan NewChannel. */
|
|
89
|
+
channels(): AsyncIterable<IncomingChannel>;
|
|
90
|
+
/** Go's <-chan *Request, for the global requests. */
|
|
91
|
+
requests(): AsyncIterable<GlobalRequest>;
|
|
92
|
+
/** forwarded-tcpip, for a tcpip-forward that the server accepted: address is the listened address, origin host:port of the peer. */
|
|
93
|
+
forward(network: 'tcp', address: string, origin: string): Promise<Duplex>;
|
|
94
|
+
/** forwarded-streamlocal@openssh.com, for a streamlocal-forward that the server accepted. It carries no origin. */
|
|
95
|
+
forward(network: 'unix', path: string): Promise<Duplex>;
|
|
96
|
+
close(): Promise<void>;
|
|
97
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
/** A session channel that the server accepted. */
|
|
100
|
+
export declare class ServerSession {
|
|
101
|
+
#private;
|
|
102
|
+
readonly stdin: Readable;
|
|
103
|
+
readonly stdout: Writable;
|
|
104
|
+
readonly stderr: Writable;
|
|
105
|
+
private constructor();
|
|
106
|
+
requests(): AsyncIterable<SessionRequest>;
|
|
107
|
+
/** Sends exit-status, or exit-signal, and closes the channel. */
|
|
108
|
+
exit(status: number | {
|
|
109
|
+
readonly signal: SignalName | `${string}@${string}`;
|
|
110
|
+
readonly coreDumped?: boolean;
|
|
111
|
+
readonly errorMessage?: string;
|
|
112
|
+
}): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAe,KAAK,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkBhF,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAA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