Help us shape the future of Go! Take the 2026 Go Developer Survey

fastdialer

module
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: MIT

README

Fastdialer

License Go version Release Checks GoDoc

Fastdialer is implementation of net.Dialer with lot of features like DNS Cache , Dial History etc

Features

  • DNS Cache
  • Dial History
  • Supports Memory/Hybrid/Disk Cache.
  • Supports Old/New TLS and x509 versions
  • Supports Resolution Using Hosts File
  • Cross Platform and more..

For more details and documentation refer GoDoc.

ZTLS Fallback

When the TLS handshake of DialTLS or DialTLSWithConfig fails, fastdialer retries it once with zcrypto (ztls), to reach servers that crypto/tls rejects, such as servers with old TLS versions or legacy ciphers. The retry uses ztls.ChromeCiphers and the default ztls curves instead of the cipher suites and curve preferences of the config. It retries only when:

  • the dial context isn't done, the handshake didn't time out, and the server's reply, if any, was TLS.
  • the TLS config allows versions older than TLS 1.3.
  • the TLS config uses nothing that zcrypto can't carry over: InsecureSkipVerify is true, and the config sets no VerifyPeerCertificate or VerifyConnection callback, no GetClientCertificate, and no Encrypted Client Hello settings. A Certificates chain is copied onto the retry. Otherwise the retry would verify the server differently, omit a certificate chosen by callback, or send the hidden server name in the clear.

Plain dials, including dials through a proxy, impersonated dials and ztls dials never fall back. A dial that falls back returns a *ztls.Conn instead of a *tls.Conn, which WithTLSData doesn't record. If the retry fails too, the error includes both failures.

To disable the fallback, set DisableZtlsFallback in the options or DISABLE_ZTLS_FALLBACK=true in the environment. Either one is enough.

Pinning a Host to an IP

WithResolveOverride makes dials to one host connect to the given IP instead of resolving it, like curl --resolve. The hostname is still sent as SNI, and other hosts dialed with the same context, such as redirect targets or a proxy, are resolved as usual.

ctx := fastdialer.WithResolveOverride(context.Background(), "example.com", "192.0.2.10")
conn, err := dialer.DialTLS(ctx, "tcp", "example.com:443")

Example

An Example showing usage of fastdialer as a library is specified here

cd example/
go run main.go

License

fastdialer is distributed under MIT License

Directories

Path Synopsis
example
concurrent command
impersonate command
simple command
fastdialer is a dialer package containing a dns/tls cache layer
fastdialer is a dialer package containing a dns/tls cache layer
ja3
ja3 is a package for creating JA3 fingerprints from TLS clients.
ja3 is a package for creating JA3 fingerprints from TLS clients.
ja3/impersonate
impersonate package contains strategy to impersonate a client and define an alias for the internal client tls spefications
impersonate package contains strategy to impersonate a client and define an alias for the internal client tls spefications
metafiles
metafiles are metadata files related to networking like /etc/hosts etc
metafiles are metadata files related to networking like /etc/hosts etc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL