|
1 |
| -using P2PNet.NetworkPackets; |
| 1 | +using P2PNet.Distribution.NetworkTasks; |
| 2 | +using P2PNet.NetworkPackets; |
2 | 3 | using P2PNet.Peers;
|
3 | 4 | using System;
|
4 | 5 | using System.Collections.Generic;
|
|
12 | 13 | namespace P2PNet.Distribution
|
13 | 14 | {
|
14 | 15 | /// <summary>
|
15 |
| - /// The Distribution_Protocol provides uniformity with data exchange, packet formatting, and other functions within the peer-to-peer network. |
| 16 | + /// The DistributionProtocol provides uniformity with data exchange, packet formatting, and other functions within the peer-to-peer network. |
16 | 17 | /// This should be included as a static reference.
|
17 | 18 | /// </summary>
|
18 |
| - public static class Distribution_Protocol |
| 19 | + public static class DistributionProtocol |
19 | 20 | {
|
20 | 21 | public struct MessageTags
|
21 | 22 | {
|
@@ -198,112 +199,9 @@ public static T Deserialize<T>(string json)
|
198 | 199 | #endregion
|
199 | 200 | }
|
200 | 201 |
|
201 |
| - #region Tasks |
202 |
| - |
203 |
| - /// <summary> |
204 |
| - /// Defines the types of tasks that can be executed within the peer-to-peer network. |
205 |
| - /// </summary> |
206 |
| - public enum TaskType |
207 |
| - { |
208 |
| - /// <summary> |
209 |
| - /// Block a peer and removes it from the network. |
210 |
| - /// </summary> |
211 |
| - BlockAndRemovePeer, |
212 |
| - |
213 |
| - /// <summary> |
214 |
| - /// Block a specific IP address from connecting to the network. |
215 |
| - /// </summary> |
216 |
| - BlockIP, |
217 |
| - |
218 |
| - /// <summary> |
219 |
| - /// Send a message to a specific peer or group of peers. |
220 |
| - /// </summary> |
221 |
| - SendMessage, |
222 |
| - |
223 |
| - /// <summary> |
224 |
| - /// Send a ping to a specific peer to check its availability. |
225 |
| - /// </summary> |
226 |
| - PingPeer, |
227 |
| - |
228 |
| - /// <summary> |
229 |
| - /// Disconnect a specific peer from the network. |
230 |
| - /// </summary> |
231 |
| - DisconnectPeer, |
232 |
| - |
233 |
| - /// <summary> |
234 |
| - /// Authorize a peer to perform certain actions or access certain resources. |
235 |
| - /// </summary> |
236 |
| - AuthorizePeer, |
237 |
| - |
238 |
| - /// <summary> |
239 |
| - /// Revoke the authorization of a peer. |
240 |
| - /// </summary> |
241 |
| - RevokePeerAuthorization, |
242 |
| - |
243 |
| - /// <summary> |
244 |
| - /// Request specific data from a peer. |
245 |
| - /// </summary> |
246 |
| - RequestData, |
247 |
| - |
248 |
| - /// <summary> |
249 |
| - /// Send specific data to a peer. |
250 |
| - /// </summary> |
251 |
| - SendData, |
252 |
| - |
253 |
| - /// <summary> |
254 |
| - /// Synchronize data between peers. |
255 |
| - /// </summary> |
256 |
| - SynchronizeData, |
257 |
| - |
258 |
| - /// <summary> |
259 |
| - /// Update network settings or peer settings. |
260 |
| - /// </summary> |
261 |
| - UpdateSettings, |
262 |
| - |
263 |
| - /// <summary> |
264 |
| - /// Verify the PGP signature of a message or command. |
265 |
| - /// </summary> |
266 |
| - VerifySignature, |
267 |
| - |
268 |
| - /// <summary> |
269 |
| - /// Request the public key of a peer or bootstrap server. |
270 |
| - /// </summary> |
271 |
| - RequestPublicKey, |
272 |
| - |
273 |
| - /// <summary> |
274 |
| - /// Send the public key to a peer or bootstrap server. |
275 |
| - /// </summary> |
276 |
| - SendPublicKey, |
277 |
| - |
278 |
| - /// <summary> |
279 |
| - /// Send a heartbeat signal to check the status of a peer or server. |
280 |
| - /// </summary> |
281 |
| - Heartbeat |
282 |
| - } |
283 |
| - |
284 | 202 | /// <summary>
|
285 |
| - /// Represents a network task that can be executed within the peer-to-peer network. |
| 203 | + /// This region keeps the packet objects and classes AOT compliant for JSON serialization. |
286 | 204 | /// </summary>
|
287 |
| - /// <remarks> |
288 |
| - /// A network task defines an action to be performed, such as blocking a peer, sending a message, or synchronizing data. |
289 |
| - /// Each task is identified by a <see cref="TaskType"/> and can include additional data in the form of key-value pairs. |
290 |
| - /// </remarks> |
291 |
| - public sealed class NetworkTask |
292 |
| - { |
293 |
| - public TaskType TaskType { get; set; } |
294 |
| - public Dictionary<string, string> TaskData { get; set; } |
295 |
| - |
296 |
| - [JsonConstructor] |
297 |
| - public NetworkTask() { } |
298 |
| - |
299 |
| - public byte[] ToByte() |
300 |
| - { |
301 |
| - return Encoding.UTF8.GetBytes(Distribution_Protocol.Serialize(this)); |
302 |
| - } |
303 |
| - } |
304 |
| - |
305 |
| - #endregion |
306 |
| - |
307 | 205 | #region PACKET_CONTEXT
|
308 | 206 | [JsonSerializable(typeof(PureMessagePacket))]
|
309 | 207 | public partial class PureMessagePacketContext : JsonSerializerContext { }
|
|
0 commit comments