create static method

SshClient create({
  1. required SshClientConfig config,
  2. required List<SshAuthMethod> authMethods,
  3. SshSecureSocketTransport? transport,
  4. SshUserAuthProtocolAuthenticator authenticator = const SshUserAuthProtocolAuthenticator(),
  5. int sftpProtocolVersion = 3,
})

Implementation

static SshClient create({
  required SshClientConfig config,
  required List<SshAuthMethod> authMethods,
  SshSecureSocketTransport? transport,
  SshUserAuthProtocolAuthenticator authenticator =
      const SshUserAuthProtocolAuthenticator(),
  int sftpProtocolVersion = 3,
}) {
  final SshSecureSocketTransport resolvedTransport =
      transport ?? SshSecureSocketTransport();
  final SshPacketChannelFactory channelFactory = SshPacketChannelFactory(
    transport: resolvedTransport,
  );

  return SshClient(
    config: config,
    authMethods: authMethods,
    transport: resolvedTransport,
    authenticator: authenticator,
    channelFactory: channelFactory,
    sessionManager: SshProtocolSessionManager(channelFactory: channelFactory),
    execService: SshProtocolExecService(channelFactory: channelFactory),
    sftpSubsystem: SshProtocolSftpSubsystem(
      channelFactory: channelFactory,
      protocolVersion: sftpProtocolVersion,
    ),
    portForwardingService: SshIoPortForwardingService(
      transport: resolvedTransport,
      channelFactory: channelFactory,
    ),
  );
}