namespace SHH.Contracts
{
///
/// 服务端身份注册信息 (DTO)
/// 用于服务端主动连上客户端后,上报自身的端口和身份信息
///
public class RegisterPayload
{
#region --- 0. 协议自描述 ---
/// 协议类型标识 (人工可读)
public string Protocol { get; set; } = ProtocolCodes.ServerRegister;
#endregion
#region --- 1. 身份标识 ---
/// 进程 ID (用于区分同一台机器上的多个实例)
public int ProcessId { get; set; }
/// 调用进程 ID (用于区分同一台机器上的多个实例)
public int InvokeProcId { get; set; }
///
/// 实例唯一标识符
/// 启动时通过命令行传入,例如 "Gateway_Factory_A"
///
public string InstanceId { get; set; } = string.Empty;
/// 服务端版本号
public string Version { get; set; } = "1.0.0";
#endregion
#region --- 2. 网络诊断信息 (用于运维) ---
///
/// 服务端所在的局域网 IP
/// 客户端无法直接连接此IP(因为可能是内网),但运维人员需要知道
///
public string ServerIp { get; set; } = string.Empty;
///
/// WebAPI 监听端口 (HTTP)
/// 用于运维人员打开 Swagger 进行调试
///
public int WebApiPort { get; set; }
/// Grpc通讯端口
public int GrpcPort { get; set; }
#endregion
#region --- 3. 运行时状态 ---
/// 启动时间
public DateTime StartTime { get; set; }
/// 描述信息 (可选)
public string Description { get; set; } = string.Empty;
#endregion
}
}