Kokoabim.OnionHttpClient
0.1.1
dotnet add package Kokoabim.OnionHttpClient --version 0.1.1
NuGet\Install-Package Kokoabim.OnionHttpClient -Version 0.1.1
<PackageReference Include="Kokoabim.OnionHttpClient" Version="0.1.1" />
<PackageVersion Include="Kokoabim.OnionHttpClient" Version="0.1.1" />
<PackageReference Include="Kokoabim.OnionHttpClient" />
paket add Kokoabim.OnionHttpClient --version 0.1.1
#r "nuget: Kokoabim.OnionHttpClient, 0.1.1"
#:package Kokoabim.OnionHttpClient@0.1.1
#addin nuget:?package=Kokoabim.OnionHttpClient&version=0.1.1
#tool nuget:?package=Kokoabim.OnionHttpClient&version=0.1.1
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.- macOS (via Homebrew):
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 | 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. |
-
net10.0
- Microsoft.Extensions.Hosting (>= 10.0.14)
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 |