dart_mosh 0.0.4 copy "dart_mosh: ^0.0.4" to clipboard
dart_mosh: ^0.0.4 copied to clipboard

Dart building blocks for launching and speaking the Mosh mobile shell protocol.

example/main.dart

import 'dart:convert';

import 'package:dart_mosh/dart_mosh.dart';

Future<void> main() async {
  final bootstrap = MoshSshBootstrap(locale: 'C.UTF-8', term: 'xterm-256color');

  print('Run over SSH: ${bootstrap.command()}');

  const output = 'MOSH CONNECT 60001 AAECAwQFBgcICQoLDA0ODw';
  final server = MoshServerConfig.parse(output, host: 'example.com');

  final session = await MoshSession.connect(
    server: server,
    cipher: MoshPacketCipher.aesOcb(server.key),
    columns: 120,
    rows: 40,
  );

  session.stdout.listen((bytes) {
    print(utf8.decode(bytes, allowMalformed: true));
  });

  session.send(utf8.encode('echo hello from mosh\r'));
  await session.close();
}
0
likes
160
points
414
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dart building blocks for launching and speaking the Mosh mobile shell protocol.

Repository (GitHub)
View/report issues

Topics

#mosh #ssh #terminal #networking

License

Apache-2.0 (license)

Dependencies

pointycastle

More

Packages that depend on dart_mosh