Skip to content

Repository files navigation

TlsClient.Net

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.


📦 Packages

ℹ️ 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 separate TlsClient.Core package.


🧭 Which one should I use?

  • Use TlsClient.Native if 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.Api if 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.


⚙️ Installation

Option A — Native (in-process)

  1. Add the package:
dotnet add package TlsClient.Native
  1. Add the runtime-specific native binary for your target platform:
OSArchNuGet package
Windowsx64TlsClient.Native.win-x64
Windowsx86TlsClient.Native.win-x32
Linux (Ubuntu)amd64TlsClient.Native.linux-ubuntu-amd64
Linuxarm64TlsClient.Native.linux-arm64
Linuxarmv7TlsClient.Native.linux-armv7
Linux (Alpine)amd64TlsClient.Native.linux-alpine-amd64
macOS (Apple)arm64TlsClient.Native.darwin-arm64
macOS (Intel)amd64TlsClient.Native.darwin-amd64
  1. Initialize once at startup:
usingTlsClient.Native;NativeTlsClient.Initialize("{PATH_TO_NATIVE_LIBRARY}");// e.g. "C:\\tools\\tls-client\\tls-client-windows-64-1.11.0.dll"

⚠️ Without NativeTlsClient.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.


Option B — API (service)

If you run a tls-client HTTP service (local/remote):

dotnet add package TlsClient.Api

No native init required; just point to the service URL and provide an API key.


🚀 Quick Start

Native (in-process)

usingTlsClient.Native;usingTlsClient.Core.Models.Requests;// bundled inside packageNativeTlsClient.Initialize("{PATH_TO_NATIVE_LIBRARY}");usingvarclient=newNativeTlsClient();varres=client.Request(newRequest{RequestUrl="https://httpbin.io/get"});Console.WriteLine(res.Status);

API (service)

usingTlsClient.Api;usingTlsClient.Core.Models.Requests;// bundled inside packageusingvarclient=newApiTlsClient(newUri("http://127.0.0.1:8080"),"my-auth-key-1");varres=client.Request(newRequest{RequestUrl="https://httpbin.io/get"});Console.WriteLine(res.Status);

For additional scenarios, please refer to the test projects in each package.


🧯 Support & Issues


🔬 Learn More

This focuses on setup. For additional scenarios, please refer to the test projects.


📜 License

Licensed under the MIT License. See LICENSE for details.


©️ Copyright

© 2025 TlsClient.NET — Maintained by Eren Kurt

About

C# HttpClient / RestSharp Client for tls-client

Topics

Resources

Stars

32 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages