DotI2p 0.6.3
dotnet add package DotI2p --version 0.6.3
NuGet\Install-Package DotI2p -Version 0.6.3
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="DotI2p" Version="0.6.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotI2p" Version="0.6.3" />
<PackageReference Include="DotI2p" />
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 DotI2p --version 0.6.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DotI2p, 0.6.3"
#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 DotI2p@0.6.3
#: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=DotI2p&version=0.6.3
#tool nuget:?package=DotI2p&version=0.6.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DotI2p
A .NET library for communicating with an I2Pd router via the SAM v3.3 protocol. It lets you create anonymous streaming and raw (UDP) connections over the I2P network from any .NET application.
Prerequisites
- An I2Pd router running with the SAM interface enabled (default TCP port
7656, default UDP port7655) - .NET SDK 6.0 or later (the library targets
netstandard2.1)
Installation
dotnet add package DotI2p
Quick Start
using DotI2p;
// Connect to the local SAM bridge
var connection = new SamConnection(); // defaults to 127.0.0.1:7656
await connection.ConnectAsync();
// Create a session and generate a destination
var session = new SamSession(connection);
var destination = await session.CreateStreamAsync();
Console.WriteLine($"Listening on: {destination.GetB32Hostname()}");
Usage
Connecting to a Remote Destination
// Look up a .b32.i2p hostname
var remote = await session.HostNameLookupAsync("something.b32.i2p");
// Open a virtual stream and connect
var virtualStream = session.CreateVirtualStream();
var tcpClient = await virtualStream.ConnectAsync(remote);
// Use the TcpClient's NetworkStream for I/O
var stream = tcpClient.GetStream();
var writer = new StreamWriter(stream);
var reader = new StreamReader(stream);
writer.WriteLine("Hello over I2P!");
writer.Flush();
Accepting Incoming Connections
var virtualStream = session.CreateVirtualStream();
var accepted = await virtualStream.AcceptAsync();
Console.WriteLine($"Connection from: {accepted.Destination.GetB32Hostname()}");
var stream = accepted.TcpClient.GetStream();
// Read/write on stream...
Primary Sessions with Sub-Sessions (SAM 3.3)
A primary (master) session lets you create multiple stream and raw sub-sessions on a single destination:
var connection = new SamConnection();
await connection.ConnectAsync();
var session = new SamSession(connection);
var destination = await session.CreatePrimarySessionAsync();
// Create a stream sub-session for TCP-like connections
var streamSubSession = await session.CreateStreamSubSession();
var virtualStream = streamSubSession.CreateVirtualStream();
// Create a raw sub-session for UDP-like datagrams
var rawSubSession = await session.CreateRawSubSession(new RawSubSessionConfiguration
{
Port = 12345
});
Sending and Receiving Raw (UDP) Datagrams
// Send a datagram to a remote destination
await rawSubSession.SendAsync(
remoteDestination.PubKey,
fromPort: null,
toPort: null,
protocol: null,
data: System.Text.Encoding.UTF8.GetBytes("Hello via UDP!")
);
// Receive a datagram
var data = await rawSubSession.ReceiveAsync();
Custom SAM Bridge Address
using System.Net;
var connection = new SamConnection(
IPAddress.Parse("192.168.1.100"),
tcpPort: 7656,
udpPort: 7655
);
await connection.ConnectAsync();
API Overview
| Class | Purpose |
|---|---|
SamConnection |
Manages the TCP/UDP connection to the SAM bridge and handles the handshake and command I/O |
SamSession |
Creates sessions (stream or primary), generates destination keys, and performs hostname lookups |
SamVirtualStream |
Opens stream connections (STREAM CONNECT) or accepts incoming ones (STREAM ACCEPT) |
SamStreamSubSession |
A stream sub-session created from a primary session; provides CreateVirtualStream() |
SamRawSubSession |
A raw (UDP) sub-session for sending and receiving datagrams via the I2P network |
RawSubSessionConfiguration |
Configuration for creating a raw sub-session (port, host, protocol filters) |
DestinationKey |
Wraps an I2P destination (public + optional private key); can derive .b32.i2p hostnames |
AcceptedConnection |
Represents an accepted inbound stream connection (destination + TcpClient) |
CommandResponse |
Parses SAM protocol responses into a response type and key-value dictionary |
ExceptionFactory |
Maps SAM error codes (CANT_REACH_PEER, TIMEOUT, etc.) to typed exceptions |
Building from Source
dotnet build doti2p.slnx
Running the Tests
dotnet test DotI2p.Tests
Running the Sample Client
The included SampleClient project demonstrates streaming and raw (UDP) modes, each with a client and server:
# Server mode — listens for incoming connections
dotnet run --project SampleClient
# Client mode — connects to a remote destination
dotnet run --project SampleClient -- <destination-or-hostname.b32.i2p>
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Multiformats.Base (>= 2.0.2)
- System.IO.Hashing (>= 10.0.8)
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 |
|---|---|---|
| 0.6.3 | 117 | 5/27/2026 |
| 0.6.2 | 116 | 5/27/2026 |
| 0.6.1 | 118 | 5/27/2026 |
| 0.6.0 | 111 | 5/27/2026 |
| 0.5.1 | 107 | 5/19/2026 |
| 0.5.0 | 103 | 5/17/2026 |
| 0.4.3 | 110 | 5/17/2026 |
| 0.4.2 | 103 | 5/16/2026 |
| 0.4.1 | 104 | 5/16/2026 |
| 0.4.0 | 99 | 5/16/2026 |
| 0.3.0 | 109 | 5/15/2026 |
| 0.2.1 | 108 | 5/15/2026 |
| 0.2.0 | 110 | 5/14/2026 |
| 0.1.3 | 110 | 5/13/2026 |
| 0.1.2 | 121 | 5/8/2026 |
| 0.1.1 | 110 | 5/8/2026 |
| 0.1.0 | 103 | 5/7/2026 |