add ssh compression option (#10396)

This commit is contained in:
loopx9 2025-05-25 14:48:09 +08:00 committed by GitHub
parent 4a5087afc1
commit 020372c902
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 18 additions and 3 deletions

View File

@ -6,6 +6,7 @@ export const supportedAlgorithms = {
[SSHAlgorithmType.HOSTKEY]: russh.getSupportedKeyTypes().filter(x => x !== 'none'),
[SSHAlgorithmType.CIPHER]: russh.getSupportedCiphers().filter(x => x !== 'clear'),
[SSHAlgorithmType.HMAC]: russh.getSupportedMACs().filter(x => x !== 'none'),
[SSHAlgorithmType.COMPRESSION]: russh.getSupportedCompressionAlgorithms().reverse(),
}
export const defaultAlgorithms = {
@ -42,4 +43,9 @@ export const defaultAlgorithms = {
'hmac-sha1-etm@openssh.com',
'hmac-sha1',
],
[SSHAlgorithmType.COMPRESSION]: [
'zlib@openssh.com',
'zlib',
'none',
],
}

View File

@ -5,6 +5,8 @@ export enum SSHAlgorithmType {
KEX = 'kex',
CIPHER = 'cipher',
HOSTKEY = 'serverHostKey',
COMPRESSION = 'compression',
}
export interface SSHProfile extends ConnectableTerminalProfile {

View File

@ -285,7 +285,13 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
.w-75
div(*ngFor='let alg of supportedAlgorithms.serverHostKey')
checkbox([text]='alg', [(ngModel)]='algorithms.serverHostKey[alg]')
.form-line.align-items-start
.header
.title Compression
.w-75
div(*ngFor='let alg of supportedAlgorithms.compression')
checkbox([text]='alg', [(ngModel)]='algorithms.compression[alg]')
li(ngbNavItem)
a(ngbNavLink, translate) Colors
ng-template(ngbNavContent)

View File

@ -107,7 +107,7 @@ export class SSHProfileSettingsComponent {
this.profile.options.algorithms![k] = Object.entries(this.algorithms[k])
.filter(([_, v]) => !!v)
.map(([key, _]) => key)
this.profile.options.algorithms![k].sort()
if(k !== SSHAlgorithmType.COMPRESSION) { this.profile.options.algorithms![k].sort() }
}
if (this.connectionMode !== 'jumpHost') {

View File

@ -55,7 +55,7 @@ export class SSHProfilesService extends QuickConnectProfileProvider<SSHProfile>
super()
for (const k of Object.values(SSHAlgorithmType)) {
this.configDefaults.options.algorithms[k] = [...defaultAlgorithms[k]]
this.configDefaults.options.algorithms[k].sort()
if (k !== SSHAlgorithmType.COMPRESSION) { this.configDefaults.options.algorithms[k].sort() }
}
}

View File

@ -315,6 +315,7 @@ export class SSHSession {
kex: this.profile.options.algorithms?.[SSHAlgorithmType.KEX]?.filter(x => supportedAlgorithms[SSHAlgorithmType.KEX].includes(x)),
mac: this.profile.options.algorithms?.[SSHAlgorithmType.HMAC]?.filter(x => supportedAlgorithms[SSHAlgorithmType.HMAC].includes(x)),
key: this.profile.options.algorithms?.[SSHAlgorithmType.HOSTKEY]?.filter(x => supportedAlgorithms[SSHAlgorithmType.HOSTKEY].includes(x)),
compression: this.profile.options.algorithms?.[SSHAlgorithmType.COMPRESSION]?.filter(x => supportedAlgorithms[SSHAlgorithmType.COMPRESSION].includes(x)),
},
keepaliveIntervalSeconds: Math.round((this.profile.options.keepaliveInterval ?? 15000) / 1000),
keepaliveCountMax: this.profile.options.keepaliveCountMax,