mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
34 lines
695 B
Dart
34 lines
695 B
Dart
import 'package:dartssh2/dartssh2.dart';
|
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
|
import 'package:toolbox/data/model/server/server_status.dart';
|
|
|
|
class Server {
|
|
ServerPrivateInfo spi;
|
|
ServerStatus status;
|
|
SSHClient? client;
|
|
ServerState state;
|
|
|
|
Server(this.spi, this.status, this.client, this.state);
|
|
}
|
|
|
|
enum ServerState {
|
|
failed,
|
|
disconnected,
|
|
connecting,
|
|
|
|
/// Connected to server
|
|
connected,
|
|
|
|
/// Status parsing
|
|
loading,
|
|
|
|
/// Status parsing finished
|
|
finished;
|
|
|
|
bool get shouldConnect => this < ServerState.connecting;
|
|
|
|
bool get canViewDetails => this == ServerState.finished;
|
|
|
|
operator <(ServerState other) => index < other.index;
|
|
}
|