Skip to content

Commit

Permalink
src: Implement custom server port.
Browse files Browse the repository at this point in the history
  • Loading branch information
junkern committed Apr 5, 2020
1 parent 416dc45 commit d2d5e6b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class SSHConnection {
return new Promise<Client>(async (resolve) => {
const options = {
host,
port: this.options.endPort,
username: this.options.username,
privateKey: this.options.privateKey
}
Expand Down
8 changes: 8 additions & 0 deletions test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ services:
context: ./
dockerfile: ./server/Dockerfile

server-different-port:
ports:
- 23:23
build:
context: ./
dockerfile: ./server/Dockerfile
command: /usr/sbin/sshd -D -p 23

bastion:
ports:
- 22:22
Expand Down
2 changes: 1 addition & 1 deletion test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('node-ssh-forward', async () => {
it('with a custom end port', async () => {
const ssh = new SSHConnection({
username: 'root',
endHost: 'server',
endHost: 'server-different-port',
endPort: 23
})
await ssh.executeCommand('uptime')
Expand Down

0 comments on commit d2d5e6b

Please sign in to comment.