DotI2p 0.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DotI2p --version 0.2.1
                    
NuGet\Install-Package DotI2p -Version 0.2.1
                    
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.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DotI2p" Version="0.2.1" />
                    
Directory.Packages.props
<PackageReference Include="DotI2p" />
                    
Project file
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.2.1
                    
#r "nuget: DotI2p, 0.2.1"
                    
#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.2.1
                    
#: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.2.1
                    
Install as a Cake Addin
#tool nuget:?package=DotI2p&version=0.2.1
                    
Install as a Cake Tool

DotI2p

A .NET library for communicating with an I2Pd router via the SAM v3.1 protocol. It lets you create anonymous streaming connections over the I2P network from any .NET application.

Prerequisites

  • An I2Pd router running with the SAM interface enabled (default port 7656)
  • .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...

Custom SAM Bridge Address

using System.Net;

var connection = new SamConnection(IPAddress.Parse("192.168.1.100"), port: 7656);
await connection.ConnectAsync();

API Overview

Class Purpose
SamConnection Manages the TCP connection to the SAM bridge and handles the handshake and command I/O
SamSession Creates sessions, generates destination keys, and performs hostname lookups
SamVirtualStream Opens stream connections (STREAM CONNECT) or accepts incoming ones (STREAM ACCEPT)
DestinationKey Wraps an I2P destination (public + optional private key); can derive .b32.i2p hostnames
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 Sample Client

The included SampleClient project demonstrates both client and server modes:

# 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

MIT

Product 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.

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 119 5/27/2026
0.6.2 118 5/27/2026
0.6.1 118 5/27/2026
0.6.0 111 5/27/2026
0.5.1 109 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 101 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 123 5/8/2026
0.1.1 110 5/8/2026
0.1.0 103 5/7/2026