Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

OnionFruit™ API

CI Publish CI Unit Tests Nuget Nuget Downloads DragonFruit Discord

Overview

The OnionFruit™ API provides developers with an easy way to get access to metrics from the Tor service, including graph data and network overviews.

Usage

  1. Install the NuGet package (see icons above)
  2. Create an ApiClient for the lifetime of the program
  3. Use one of the extension methods, or create your own request/response combo
using System.Threading.Tasks;
using DragonFruit.Data;
using DragonFruit.Data.Serializers.Newtonsoft;
using DragonFruit.OnionFruit.Api.Requests;
using DragonFruit.OnionFruit.Api.Extensions;

namespace OnionFruit.Demo;

static readonly ApiClient _client = new ApiClient<ApiJsonSerializer>();

public static async Task Main(string[] args)
{
    // get the first 500 nodes in the tor directory
    var data = _client.GetTorDetails(500);
    
    // or asynchronously
    var asyncData = await _client.GetTorDetailsAsync(500);
    
    // and if the basic usage is not enough, create the request and perform it manually:
    var customRequest = new TorStatusBandwidthRequest
    {
        CountryCode = "US"
    };
    
    // check the extension methods' return types to determine the type to pass to the client
    var customResponse = await _client.PerformAsync<TorStatusResponse<TorNodeBandwidthHistory>>(customRequest);
}

License

These (the api and tooling) are open-source components of OnionFruit™. These are licensed under the MIT license. Refer to the license file for more info.