You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.2 KiB
64 lines
1.2 KiB
|
1 month ago
|
using System;
|
||
|
|
|
||
|
|
namespace AuroraDesk.Core.Entities;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 表示 SSH 会话的当前状态
|
||
|
|
/// </summary>
|
||
|
|
public enum SshSessionStatus
|
||
|
|
{
|
||
|
|
Disconnected = 0,
|
||
|
|
Connecting = 1,
|
||
|
|
Connected = 2,
|
||
|
|
Error = 3
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 表示 SSH 消息的方向
|
||
|
|
/// </summary>
|
||
|
|
public enum SshMessageDirection
|
||
|
|
{
|
||
|
|
Outgoing,
|
||
|
|
Incoming,
|
||
|
|
System
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// SSH 消息模型,包含消息内容与元数据
|
||
|
|
/// </summary>
|
||
|
|
public sealed record SshMessage(
|
||
|
|
Guid SessionId,
|
||
|
|
SshMessageDirection Direction,
|
||
|
|
string Content,
|
||
|
|
DateTime Timestamp,
|
||
|
|
bool IsError = false);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 创建 SSH 会话所需的参数
|
||
|
|
/// </summary>
|
||
|
|
public sealed record SshSessionOptions(
|
||
|
|
string Host,
|
||
|
|
int Port,
|
||
|
|
string UserName,
|
||
|
|
string? Password = null,
|
||
|
|
string? PrivateKeyPath = null,
|
||
|
|
string? PrivateKeyPassphrase = null,
|
||
|
|
string? DisplayName = null,
|
||
|
|
bool AllowAnyHostKey = true,
|
||
|
|
string? PreferredShell = null,
|
||
|
|
string? SshExecutablePath = null);
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// SSH 会话的简要信息
|
||
|
|
/// </summary>
|
||
|
|
public sealed record SshSessionInfo(
|
||
|
|
Guid SessionId,
|
||
|
|
string DisplayName,
|
||
|
|
string Host,
|
||
|
|
int Port,
|
||
|
|
string UserName,
|
||
|
|
SshSessionStatus Status,
|
||
|
|
DateTime CreatedAtUtc);
|
||
|
|
|
||
|
|
|