SSHClient constructor

SSHClient(
  1. SSHSocket socket, {
  2. required String username,
  3. SSHPrintHandler? printDebug,
  4. SSHPrintHandler? printTrace,
  5. SSHAlgorithms algorithms = const SSHAlgorithms(),
  6. SSHHostkeyVerifyHandler? onVerifyHostKey,
  7. List<SSHKeyPair>? identities,
  8. SSHPasswordRequestHandler? onPasswordRequest,
  9. SSHChangePasswordRequestHandler? onChangePasswordRequest,
  10. SSHUserInfoRequestHandler? onUserInfoRequest,
  11. SSHUserauthBannerHandler? onUserauthBanner,
  12. SSHAuthenticatedHandler? onAuthenticated,
  13. Duration? keepAliveInterval = const Duration(seconds: 10),
})

Implementation

SSHClient(
  this.socket, {
  required this.username,
  this.printDebug,
  this.printTrace,
  this.algorithms = const SSHAlgorithms(),
  this.onVerifyHostKey,
  this.identities,
  this.onPasswordRequest,
  this.onChangePasswordRequest,
  this.onUserInfoRequest,
  this.onUserauthBanner,
  this.onAuthenticated,
  this.keepAliveInterval = const Duration(seconds: 10),
}) {
  _transport = SSHTransport(
    socket,
    isServer: false,
    printDebug: printDebug,
    printTrace: printTrace,
    algorithms: algorithms,
    onVerifyHostKey: onVerifyHostKey,
    onReady: _handleTransportReady,
    onPacket: _handlePacket,
  );

  _transport.done.then(
    (_) => _handleTransportClosed(),
    onError: (_) => _handleTransportClosed(),
  );

  _authenticated.future.catchError(
    (error, stackTrace) => _transport.closeWithError(error, stackTrace),
  );

  if (identities != null) {
    _keyPairsLeft.addAll(identities!);
  }
}