Skip to content

Commit 1efa86c

Browse files
author
François Leurent
committed
Expose server & newClient API
1 parent 27795a3 commit 1efa86c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,8 @@ You can find more examples in the `examples` directory of this repository.
10661066

10671067
* **highWaterMark** - _integer_ - This is the `highWaterMark` to use for the parser stream. **Default:** `32 * 1024`
10681068

1069+
* **server** - _object_ - This option allow you to explicitly define the tcp server `ssh2` is going to use. **Default:** `new net.Server()`
1070+
10691071
* **debug** - _function_ - Set this to a function that receives a single string argument to get detailed (local) debug information. **Default:** (none)
10701072

10711073
#### Connection events

lib/server.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,10 @@ class Server extends EventEmitter {
318318
const ident = (cfg.ident ? Buffer.from(cfg.ident) : undefined);
319319
const offer = new KexInit(algorithms);
320320

321-
this._srv = new netServer((socket) => {
321+
this._srv = cfg.server || new netServer();
322+
323+
this._srv.on('connection', (socket) => {
324+
322325
if (this._connections >= this.maxConnections) {
323326
socket.destroy();
324327
return;

0 commit comments

Comments
 (0)