@dryft/tlsclient
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

tlsclient.js

An axios based wrapper for bogdanfinn/tls-client based on ffi-rs for unparalleled performance and usability.

Performance

perf

Installation

Install with npm

  npm i @dryft/tlsclient

Usage

First run:

import { createTLSClient } from "@dryft/tlsclient";

const axios = createTLSClient();
let res = await axios.get("https://ipv4.icanhazip.com");

Definition

**
 * Create a TLS client.
 * Extra/Modified options available in config (can be also used per request (except tlsLibPath)) are:
 * - `proxy` - The proxy to use. (http://user:pass@host:port)
 * - `tlsClientIdentifier` - Choose the desired tls client. (https://github.com/bogdanfinn/tls-client/blob/master/profiles/profiles.go#L10)
 * - `customTlsClient` - Use a custom tls client instead of the default one. (https://github.com/bogdanfinn/tls-client/blob/master/cffi_dist/example_node/index_custom_client.js#L27)
 * - `tlsLibPath` - Specify path for a bogdanfinn/tls-client fork (.dll, .dylib, .so) (optional).
 * - `forceHttp1` - Force http1.
 * - `followRedirects` - Follow redirects.
 * - `insecureSkipVerify` - Skip tls certificate verification.
 * - `withRandomTLSExtensionOrder` - Randomize the order of tls extensions.
 * - `timeout` - Request timeout.
 * - `defaultHeaders` - Default headers to use. Usually the browser default headers.
 * - `headerOrder` - The order of the headers.
 * @param {TLSClientConfiguration} config The configuration.
 *
 * @returns {AxiosInstance} The TLS client.
 */
export function createTLSClient(config) {
  let adapter = createAdapter(config);
  return axios.create({
    adapter,
    ...config,
  });
}

Package Sidebar

Install

npm i @dryft/tlsclient

Weekly Downloads

11

Version

1.0.8

License

ISC

Unpacked Size

66.6 kB

Total Files

21

Last publish

Collaborators

  • dryft