-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Client,Network,Services: add TorClient
This commit aims to introduce a simple API for end users. Working with network especially Tor routers is flaky and delegating retry logic implementation to users causes NOnion to be unreliable in CI and in normal use, this commit introduces retry logic in some places where it's needed the most. This should hopefully make NOnion more reliable.
- Loading branch information
Showing
8 changed files
with
1,558 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Microsoft.FSharp.Core; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
using NUnit.Framework; | ||
|
||
using NOnion.Client; | ||
|
||
namespace NOnion.Tests | ||
{ | ||
public class TorClientTests | ||
{ | ||
private async Task BootstrapWithGithub() | ||
{ | ||
await TorClient.BootstrapWithGithubAsync(FSharpOption<DirectoryInfo>.None); | ||
} | ||
|
||
[Test] | ||
public void CanBootstrapWithGithub() | ||
{ | ||
Assert.DoesNotThrowAsync(BootstrapWithGithub); | ||
} | ||
|
||
private async Task BootstrapWithEmbeddedList() | ||
{ | ||
await TorClient.BootstrapWithEmbeddedListAsync(FSharpOption<DirectoryInfo>.None); | ||
} | ||
|
||
[Test] | ||
public void CanBootstrapWithEmbeddedList() | ||
{ | ||
Assert.DoesNotThrowAsync(BootstrapWithEmbeddedList); | ||
} | ||
|
||
private async Task CreateCircuit() | ||
{ | ||
using TorClient client = await TorClient.BootstrapWithEmbeddedListAsync(FSharpOption<DirectoryInfo>.None); | ||
await client.CreateCircuitAsync(3, CircuitPurpose.Unknown, FSharpOption<Network.CircuitNodeDetail>.None); | ||
} | ||
|
||
[Test] | ||
public void CanCreateCircuit() | ||
{ | ||
Assert.DoesNotThrowAsync(CreateCircuit); | ||
} | ||
} | ||
} |
Oops, something went wrong.