STTech.BytesIO.P2P
3.4.0-alpha61110
This is a prerelease version of STTech.BytesIO.P2P.
dotnet add package STTech.BytesIO.P2P --version 3.4.0-alpha61110
NuGet\Install-Package STTech.BytesIO.P2P -Version 3.4.0-alpha61110
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="STTech.BytesIO.P2P" Version="3.4.0-alpha61110" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="STTech.BytesIO.P2P" Version="3.4.0-alpha61110" />
<PackageReference Include="STTech.BytesIO.P2P" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add STTech.BytesIO.P2P --version 3.4.0-alpha61110
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: STTech.BytesIO.P2P, 3.4.0-alpha61110"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package STTech.BytesIO.P2P@3.4.0-alpha61110
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=STTech.BytesIO.P2P&version=3.4.0-alpha61110&prerelease
#tool nuget:?package=STTech.BytesIO.P2P&version=3.4.0-alpha61110&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
STTech.BytesIO.P2P
STTech.BytesIO.P2P 是基于 Nethermind.Libp2p 实现的点对点(P2P)字节流通信扩展库。在继承 STTech.BytesIO 统一 BytesClient 编程体验的同时,提供基于 Libp2p 协议栈的传输、加密与寻址能力。
🌟 核心特性
- 🌐 多协议传输支持:
- 支持 TCP 基础传输
- 支持 QUIC 传输(适用于弱网与低延迟场景)
- 🔒 高安全性:内置 Noise 与 TLS 协议握手加密,保护点对点传输隐私与数据安全。
- 📦 流式传输与零丢失:针对大数据包采用流式切片分发机制,杜绝数据截断。
- 🔄 统一架构:继承
BytesClient与IBytesServer,保持统一的事件驱动与异步通信模型。
🗺️ 路线图(规划中特性)
- 完整对等节点抽象(统一 Listen 与 Dial 双向直连模型)
- Kademlia DHT 分布式节点发现与 PeerId 动态寻址
- Circuit Relay v2 中继与 NAT 穿透打洞
- PubSub 消息发布/订阅系统
📦 安装
dotnet add package STTech.BytesIO.P2P
🚀 快速上手
1. 服务端(引导节点)
using STTech.BytesIO.P2P;
var server = new BootstrapServer();
server.Options.ListenAddress = "127.0.0.1";
server.Options.TcpPort = 4001;
server.PeerConnected += (s, e) =>
{
Console.WriteLine($"对等节点已接入: {e.Client.RemotePeerId}");
e.Client.OnDataReceived += (cs, ce) =>
{
Console.WriteLine($"收到客户端消息: {ce.Data.ToHexString()}");
};
};
await server.StartAsync();
Console.WriteLine($"引导节点已启动,监听地址: {string.Join(", ", server.ListenAddresses)}");
2. 客户端(Peer 节点)
using STTech.BytesIO.P2P;
var client = new PeerClient();
client.OnDataReceived += (s, e) =>
{
Console.WriteLine($"收到节点消息: {e.Data.ToHexString()}");
};
// 通过 Multiaddr 连接目标对等节点
await client.ConnectAsync("/ip4/127.0.0.1/tcp/4001/p2p/12D3KooW...");
// 发送数据
await client.SendAsync(new byte[] { 0x01, 0x02, 0x03 });
📄 开源许可证
本项目基于 Apache-2.0 协议开源。
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Nethermind.Libp2p (>= 1.0.0-preview.51)
- STTech.BytesIO (>= 3.4.0-alpha61110)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.4.0-alpha61110 | 43 | 11/10/2026 |
| 3.3.3-alpha61105 | 62 | 11/5/2026 |
| 3.3.2-alpha61025 | 69 | 10/25/2026 |
| 3.3.1-alpha61015 | 66 | 10/14/2026 |
| 3.3.0.1-alpha61010 | 71 | 10/10/2026 |
| 3.3.0-alpha0730 | 110 | 7/29/2026 |
| 3.2.0-beta0706 | 90 | 7/12/2026 |
| 3.1.0.1-beta0630 | 94 | 6/30/2026 |
| 3.1.0-beta0629 | 89 | 6/29/2026 |