chore: initial project import
This commit is contained in:
commit
26620707a0
347 files changed
+56172
No files matched your search
@@ -0,0 +1,52 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Fleet.Rpc;
|
||||
|
||||
/// <summary>
|
||||
/// 节点间点对点会话的握手(Probe → Agent,TLS 帧)。除了签名认证,双方各生成一个临时 ECDH 密钥,
|
||||
/// 经过 HKDF 派生出数据面使用的 <c>session_id</c> 与 <c>session_key</c>(所以不需要单独的“下发密钥”方法)。
|
||||
/// </summary>
|
||||
public static class PeerMethods
|
||||
{
|
||||
public const string Challenge = "fleet.peer.challenge";
|
||||
public const string Auth = "fleet.peer.auth";
|
||||
}
|
||||
|
||||
public sealed class PeerChallengeParams
|
||||
{
|
||||
[JsonPropertyName("nonce")]
|
||||
public string Nonce { get; set; } = "";
|
||||
|
||||
/// <summary>服务端(监听方)的临时 ECDH 公钥(SPKI,base64)。</summary>
|
||||
[JsonPropertyName("ecdh_pub")]
|
||||
public string EcdhPublicKey { get; set; } = "";
|
||||
}
|
||||
|
||||
public sealed class PeerAuthParams
|
||||
{
|
||||
[JsonPropertyName("peer_id")]
|
||||
public string PeerId { get; set; } = "";
|
||||
|
||||
/// <summary>发起方的临时 ECDH 公钥(SPKI,base64)。</summary>
|
||||
[JsonPropertyName("ecdh_pub")]
|
||||
public string EcdhPublicKey { get; set; } = "";
|
||||
|
||||
/// <summary>对 <c>fleet|v1|peer|{peer_id}|{nonce}|{client_ecdh_pub}|{server_ecdh_pub}</c> 的签名(base64)。</summary>
|
||||
[JsonPropertyName("signature")]
|
||||
public string Signature { get; set; } = "";
|
||||
|
||||
/// <summary>发起方的程序版本(可选,只用于展示)。</summary>
|
||||
[JsonPropertyName("version")]
|
||||
public string? Version { get; set; }
|
||||
}
|
||||
|
||||
public sealed class PeerAuthResult
|
||||
{
|
||||
[JsonPropertyName("session_id")]
|
||||
public string SessionId { get; set; } = "";
|
||||
}
|
||||
|
||||
[JsonSerializable(typeof(PeerChallengeParams))]
|
||||
[JsonSerializable(typeof(PeerAuthParams))]
|
||||
[JsonSerializable(typeof(PeerAuthResult))]
|
||||
public sealed partial class PeerRpcContext : JsonSerializerContext;
|
||||
Reference in new issue
Block a user