A .NET wrapper around bogdanfinn/tls-client. Brings advanced TLS fingerprinting, browser emulation, User-Agent control, header ordering, cookie handling, certificate validation toggles, and proxy support to .NET.
-
Native
TlsClient.Native— calls the nativetls-clientlibrary directly (no remote service).
-
Remote Service
TlsClient.Api— talks to a runningtls-clientHTTP service.
-
Providers
TlsClient.HttpClient— drop-inHttpClientHandlerreplacement.TlsClient.RestSharp— integration with RestSharp client.
ℹ️ The shared models and builders commonly referred to as “Core” (e.g.,
Request,Response,TlsClientOptions,TlsClientIdentifier, helpers) are included within each package. You do not install a separateTlsClient.Corepackage.
- Use
TlsClient.Nativeif you want everything in-process and can ship the native library with your app. Note: Due to C# ↔ Go native interop, some environments may experience instability or edge-case issues (GC/pinning, P/Invoke marshalling, native memory management). If you hit odd crashes or hangs, prefer the API mode below. - Use
TlsClient.Apiif you want a separate service (local Docker/remote host) and a thin .NET client in your app. This avoids Go interop inside your process and is generally more robust operationally.
Both packages expose the same request/response shapes.
- Add the package:
dotnet add package TlsClient.Native- Add the runtime-specific native binary for your target platform:
| OS | Arch | NuGet package |
|---|---|---|
| Windows | x64 | TlsClient.Native.win-x64 |
| Windows | x86 | TlsClient.Native.win-x32 |
| Linux (Ubuntu) | amd64 | TlsClient.Native.linux-ubuntu-amd64 |
| Linux | arm64 | TlsClient.Native.linux-arm64 |
| Linux | armv7 | TlsClient.Native.linux-armv7 |
| Linux (Alpine) | amd64 | TlsClient.Native.linux-alpine-amd64 |
| macOS (Apple) | arm64 | TlsClient.Native.darwin-arm64 |
| macOS (Intel) | amd64 | TlsClient.Native.darwin-amd64 |
- Initialize once at startup:
using TlsClient.Native;
NativeTlsClient.Initialize("{PATH_TO_NATIVE_LIBRARY}");
// e.g. "C:\\tools\\tls-client\\tls-client-windows-64-1.11.0.dll"
⚠️ WithoutNativeTlsClient.Initialize(...), native mode won’t work.
Interop note (important): C# calling into the Go native library can be less stable on some systems (especially under heavy concurrency). If you encounter flakiness (random SIG… signals, heap issues, or unexplained timeouts), switch to TlsClient.Api.
If you run a tls-client HTTP service (local/remote):
dotnet add package TlsClient.ApiNo native init required; just point to the service URL and provide an API key.
using TlsClient.Native;
using TlsClient.Core.Models.Requests; // bundled inside package
NativeTlsClient.Initialize("{PATH_TO_NATIVE_LIBRARY}");
using var client = new NativeTlsClient();
var res = client.Request(new Request { RequestUrl = "https://httpbin.io/get" });
Console.WriteLine(res.Status);using TlsClient.Api;
using TlsClient.Core.Models.Requests; // bundled inside package
using var client = new ApiTlsClient(new Uri("http://127.0.0.1:8080"), "my-auth-key-1");
var res = client.Request(new Request { RequestUrl = "https://httpbin.io/get" });
Console.WriteLine(res.Status);For additional scenarios, please refer to the test projects in each package.
- Wrapper/packaging issues → open an issue here.
- Native TLS engine issues → bogdanfinn/tls-client.
This focuses on setup. For additional scenarios, please refer to the test projects.
Licensed under the MIT License. See LICENSE for details.
© 2025 TlsClient.NET — Maintained by Eren Kurt