Kokoabim.OnionHttpClient 0.1.1

dotnet add package Kokoabim.OnionHttpClient --version 0.1.1
                    
NuGet\Install-Package Kokoabim.OnionHttpClient -Version 0.1.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="Kokoabim.OnionHttpClient" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kokoabim.OnionHttpClient" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Kokoabim.OnionHttpClient" />
                    
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 Kokoabim.OnionHttpClient --version 0.1.1
                    
#r "nuget: Kokoabim.OnionHttpClient, 0.1.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 Kokoabim.OnionHttpClient@0.1.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=Kokoabim.OnionHttpClient&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Kokoabim.OnionHttpClient&version=0.1.1
                    
Install as a Cake Tool

C#/.NET Onion HTTP Client Library

A simple HTTP client that routes requests through The Onion Router (Tor) protocol using automatically-managed local Tor proxies.

Requirements

  • .NET 10.0 or later

  • Tor expert bundle installed

    • macOS (via Homebrew): brew install tor
    • Ubuntu: sudo apt install tor
    • Windows: Currently not supported

    Note: Tor service does not need to be running as each Tor HTTP client (class TorHttpClient) will automatically manage its own instance.

Configuration

Create a Tor control password by running tor --hash-password <YOUR_PLAIN_TEXT_PASSWORD>.

Create torrc-defaults file in the same directory as the executable with the following content:

SOCKSPort 9050
ControlPort 9051
HashedControlPassword <YOUR_HASHED_PASSWORD>

Create 'onionhttpclient.secrets.json' in the same directory as the executable with the following content:

{
    "Tor": {
        "ControlPassword": "<YOUR_PLAIN_TEXT_PASSWORD>"
    }
}

Usage

Single Tor HTTP Client (class TorHttpClient)

Manages an internal HTTP client and Tor service.

using Kokoabim.OnionHttpClient;

hostBuilder.AddOnionHttpClient();
// --- OR ---
serviceCollection.AddOnionHttpClient();

...

var httpClientSettings = new HttpClientInstanceSettings()
{
    ...
};

var torSettings = new TorInstanceSettings();

using var torHttpClient = services.GetRequiredService<ITorHttpClient>();
await torHttpClient.InitializeAsync(httpClientSettings, torSettings);

var response = await torHttpClient.GetResponseAsync(...);
// --- OR ---
var response = await torHttpClient.SendAsync(...);

...

await torHttpClient.DisconnectAsync();

Multi Tor HTTP Client (class MultiTorHttpClient)

Manages multiple internal HTTP clients and Tor services and balances requests between them.

using Kokoabim.OnionHttpClient;

hostBuilder.AddOnionHttpClient();
// --- OR ---
serviceCollection.AddOnionHttpClient();

...

var multiTorHttpClientSettings = new MultiTorHttpClientSettings
{
    BalanceStrategy = MultiTorHttpClientBalanceStrategy.RoundRobin,
    ClientCount = 2,
    ...
};

var httpClientCommonSettings = new HttpClientCommonSettings()
{
    ...
};

using var multiTorHttpClient = services.GetRequiredService<IMultiTorHttpClient>();
await multiTorHttpClient.InitializeAsync(multiTorHttpClientSettings, httpClientCommonSettings);

var response = await multiTorHttpClient.GetResponseAsync(...);
// --- OR ---
var response = await multiTorHttpClient.SendAsync(...);

...

await multiTorHttpClient.DisconnectAsync();
Product 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.

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.1.1 110 10/31/2026