TorSharp
TorSharp copied to clipboard
ARM architecture support.
This allow only run exists tor files (set TorSharpSettings.ZippedToolsDirectory and TorSharpSettings.UseExistingTools), because fetch and run code must be entire rewritten. Arm version can be downloaded here https://sourceforge.net/projects/tor-browser-ports/files/ but they have different folder structure and it require to repack .tar.gz archive to get it work.
For example tor-browser-linux-arm64-12.0.3_ALL.tar.xz: Tor and Data folders are located in tor-browser\Browser\TorBrowser. Repack example: tor-linux-aarch64-12.0.3.tar.gz
Maybe create nuget package to provide repacked tar.gz archives? Or rewrite current code to support auto download (those archive size larger that x86 bundles because they contains entire browser) and different folders structure?
Tested on Radxa Rock-5B board.
var settings = new TorSharpSettings
{
PrivoxySettings = { Disable = true }
};
using var httpClient = new HttpClient();
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
settings.ZippedToolsDirectory = Path.Combine(AppContext.BaseDirectory, "Tor");
settings.UseExistingTools = true;
}
else
{
var fetcher = new TorSharpToolFetcher(settings, httpClient);
await fetcher.FetchAsync();
}
TorProxy = new TorSharpProxy(settings);
await TorProxy.ConfigureAndStartAsync();
var handler = new HttpClientHandler
{
Proxy = new WebProxy(new Uri("socks5://localhost:" + settings.TorSettings.SocksPort))
};
HttpClient = new HttpClient(handler)
{
Timeout = TimeSpan.FromSeconds(300)
};
HttpClient.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36");