Skip to content
This repository was archived by the owner on Aug 26, 2025. It is now read-only.

Commit c7d7178

Browse files
author
Martin Wentzel
committed
Adds connection.shutdown() function.
1 parent 7a0fa82 commit c7d7178

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,17 @@ Starts an interactive shell session. Will resolve when then client has logged ou
9595

9696
#### `connection.forward(forwardOptions: Object)`
9797

98-
Established port-forwarding.
98+
Established port-forwarding. Promise resolves after the forwarding has been established. Forwarding can be stopped by calling `connection.shutdown()`
9999

100100
Possible options for `forwardOptions`:
101101

102102
* `fromPort` (required): Specifies the port on your local computer
103103
* `toPort` (required): The port on `endHost` (specified in the SSHConnection options).
104104
* `toHost` (optional): You can specify an additional `toHost` when you want to forward a port from a different server than your `endHost`.
105105

106+
#### `connection.shutdown()`
107+
108+
Closes all connections.
106109

107110
## Limitations/Todos
108111

src/Connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class SSHConnection {
4848
}
4949
}
5050

51-
private async shutdown() {
51+
public async shutdown() {
5252
for (const connection of this.connections) {
5353
connection.removeAllListeners()
5454
connection.end()

0 commit comments

Comments
 (0)