added a telnet client - fixes #760

This commit is contained in:
Eugene Pankov
2021-07-04 16:48:48 +02:00
parent 59de67ca58
commit 827345d899
33 changed files with 591 additions and 70 deletions

View File

@@ -7,7 +7,7 @@ import { debounce } from 'rxjs/operators'
import { PassThrough, Readable, Writable } from 'stream'
import { ReadLine, createInterface as createReadline, clearLine } from 'readline'
export type InputMode = null | 'readline' | 'readline-hex' // eslint-disable-line @typescript-eslint/no-type-alias
export type InputMode = null | 'local-echo' | 'readline' | 'readline-hex' // eslint-disable-line @typescript-eslint/no-type-alias
export type OutputMode = null | 'hex' // eslint-disable-line @typescript-eslint/no-type-alias
export type NewlineMode = null | 'cr' | 'lf' | 'crlf' // eslint-disable-line @typescript-eslint/no-type-alias
@@ -76,6 +76,9 @@ export class TerminalStreamProcessor {
}
feedFromTerminal (data: Buffer): void {
if (this.options.inputMode === 'local-echo') {
this.outputToTerminal.next(this.replaceNewlines(data, 'crlf'))
}
if (this.options.inputMode?.startsWith('readline')) {
this.inputReadlineInStream.write(data)
} else {

View File

@@ -12,6 +12,7 @@ export class StreamProcessingSettingsComponent {
inputModes = [
{ key: null, name: 'Normal', description: 'Input is sent as you type' },
{ key: 'local-echo', name: 'Local echo', description: 'Immediately echoes your input locally' },
{ key: 'readline', name: 'Line by line', description: 'Line editor, input is sent after you press Enter' },
{ key: 'readline-hex', name: 'Hexadecimal', description: 'Send bytes by typing in hex values' },
]

View File

@@ -42,12 +42,12 @@ export abstract class BaseSession {
this.open = false
this.closed.next()
this.destroyed.next()
this.closed.complete()
this.destroyed.complete()
this.output.complete()
this.binaryOutput.complete()
await this.gracefullyKillProcess()
}
this.closed.complete()
this.destroyed.complete()
this.output.complete()
this.binaryOutput.complete()
}
abstract start (options: unknown): void