Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support specifying the port of a remote SSH connection #13296

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [terminal] rename terminal.sendText() parameter from addNewLine to shouldExecute [#13236](https://github.com/eclipse-theia/theia/pull/13236) - contributed on behalf of STMicroelectronics
- [terminal] update terminalQuickFixProvider proposed API according to vscode 1.85 version [#13240](https://github.com/eclipse-theia/theia/pull/13240) - contributed on behalf of STMicroelectronics
- [core] added preference 'workbench.tree.indent' to control the indentation in the tree widget [#13179](https://github.com/eclipse-theia/theia/pull/13179) - contributed on behalf of STMicroelectronics
- [remote] upport specifying the port of a remote SSH connection [#13296](https://github.com/eclipse-theia/theia/pull/13296) - contributed on behalf of STMicroelectronics

<a name="breaking_changes_not_yet_released">[Breaking Changes:](#breaking_changes_not_yet_released)</a>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvi
const deferred = new Deferred<RemoteSSHConnection>();
const sshClient = new ssh2.Client();
const identityFiles = await this.identityFileCollector.gatherIdentityFiles();
const sshAuthHandler = this.getAuthHandler(user, host, identityFiles);
const hostUrl = new URL(`ssh://${host}`);
const sshAuthHandler = this.getAuthHandler(user, hostUrl.hostname, identityFiles);
sshClient
.on('ready', async () => {
const connection = new RemoteSSHConnection({
client: sshClient,
id: v4(),
name: host,
name: hostUrl.hostname,
type: 'SSH'
});
try {
Expand All @@ -102,11 +103,12 @@ export class RemoteSSHConnectionProviderImpl implements RemoteSSHConnectionProvi
deferred.reject(err);
}
}).on('end', () => {
console.log(`Ended remote connection to host '${user}@${host}'`);
console.log(`Ended remote connection to host '${user}@${hostUrl.hostname}'`);
}).on('error', err => {
deferred.reject(err);
}).connect({
host: host,
host: hostUrl.hostname,
port: hostUrl.port ? parseInt(hostUrl.port, 10) : undefined,
username: user,
authHandler: (methodsLeft, successes, callback) => (sshAuthHandler(methodsLeft, successes, callback), undefined)
});
Expand Down
Loading