Skip to content

Fastls for Go ​

Control TLS handshakes, HTTP parameters, and request header order. Choose browser profiles, custom JA3/JA4R descriptions, or complete profile.Spec input. Sessions reuse connections and consume responses as streams.

For other languages, start with Python or Node.

Install ​

Go 1.26+ is required. Run in your own Go project:

sh
go get github.com/FastTLS/fastls@v0.2.1
go get github.com/FastTLS/imitate@v0.1.1

The stable core is v0.2.1 and the default branch is main. v2 remains a historical source branch/implementation generation; the module path has no /v2 suffix. Pin a release for a fixed installation source.

First request ​

go
package main

import (
    "context"
    "fmt"
    "io"
    "log"
    "time"

    fastls "github.com/FastTLS/fastls"
    "github.com/FastTLS/fastls/imitate"
    generators "github.com/FastTLS/imitate"
)

func main() {
    options := fastls.Options{
        FingerprintProvider: generators.New(),
        VerifyTLS: true,
    }
    if _, err := imitate.Use(&options, "chrome/156/windows"); err != nil {
        log.Fatal(err)
    }
    if err := fetch(options); err != nil {
        log.Fatal(err)
    }
}

func fetch(options fastls.Options) error {
    session, err := fastls.NewSession(options)
    if err != nil { return err }
    defer session.Close()
    ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
    defer cancel()
    response, err := session.DoContext(ctx, "https://example.com/", fastls.RequestOptions{}, "GET")
    if err != nil {
        if response.Body != nil { response.Body.Close() }
        return err
    }
    defer response.Body.Close()
    fmt.Println(response.Status, response.Protocol, response.FinalURL)
    _, err = io.Copy(io.Discard, response.Body)
    return err
}

Use requires an explicit generator or offline Provider. Available IDs come from that provider's List; unknown names fail. Custom JA3/JA4R and complete Spec input do not require the generator.

Supported features ​

  • H1/H2, ordered headers, cookies, HTTP/HTTPS CONNECT, and SOCKS5 proxies.
  • JA3, JA4R, and complete Spec input, with explicit header values overriding profile defaults.
  • Concurrent reusable Sessions, cancellation, phase timeouts, streaming uploads/downloads, request/response trailers, decoding, and H2 duplex.
  • WS/WSS over H1 Upgrade and a restricted HTTP/3 path.

Defaults and limitations ​

  • Fingerprinted Go TCP TLS historically disables verification at its zero value. Explicitly set VerifyTLS:true; language SDK defaults differ.
  • Options.Timeout applies to one-shot use. Reusable Session total deadlines come from each DoContext context; RequestOptions.Timeouts configures phase budgets.
  • Close response bodies and Sessions, including bodies returned alongside errors. Reads can fail after headers. Applications decide how to handle HTTP error statuses; trailers are complete at EOF.
  • Complete Spec support covers H1/H2. H3 does not reproduce arbitrary ClientHello order and rejects proxies rather than silently going direct.
  • WS does not support compression, arbitrary Upgrade header order, redirects, or H2/H3 Extended CONNECT.
  • No browser runtime, page JavaScript, CAPTCHA handling, anonymity, or universal acceptance is provided.
  • Default-branch address policies and lifecycle fixes require checking the actual installed release tag.

More documentation ​

Sessions · Profiles/offline registration · Spec module · Services · Test tools · Development · Release policy

For issues, provide version, OS/architecture, redacted minimal code, and errors at the repository. Do not include credentials, cookies, keys, or personal data.

License and disclaimer ​

Owned code uses Apache-2.0; retain NOTICE and third-party notices.

Use authorized systems and data under applicable laws/terms. The software is as-is without guarantees of availability, suitability, anonymity, browser equivalence, or third-party acceptance. Browser names imply no endorsement. Deployers manage access, secrets, personal data, limits, and backups. License terms and applicable law govern warranty/liability; this notice adds no license restriction. See the full disclaimer.

Go v0.2.0 adds seven controlled H3 parameters and effective configuration, only in Go. SDK/service pins remain unchanged.

Apache-2.0 · Third-party materials retain their licenses