https://github.com/saucesteals/mimic
Mimic chromium's HTTP/HTTP2 and TLS implementations.
https://github.com/saucesteals/mimic
fingerprint http2 ja3 tls
Last synced: 5 months ago
JSON representation
Mimic chromium's HTTP/HTTP2 and TLS implementations.
- Host: GitHub
- URL: https://github.com/saucesteals/mimic
- Owner: saucesteals
- License: gpl-3.0
- Created: 2022-05-21T05:35:52.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-17T03:45:39.000Z (over 2 years ago)
- Last Synced: 2024-11-06T11:44:57.951Z (over 1 year ago)
- Topics: fingerprint, http2, ja3, tls
- Language: Go
- Homepage:
- Size: 53.7 KB
- Stars: 81
- Watchers: 7
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mimic
[](https://godoc.org/github.com/saucesteals/mimic)
Mimic chromium's HTTP/HTTP2 and TLS implementations.
### Documentation
- [API Reference](https://godoc.org/github.com/saucesteals/mimic)
- [Example](https://github.com/saucesteals/mimic/blob/main/examples/chrome/main.go)
### Installation
```sh
go get github.com/saucesteals/mimic
```
## Usage
```go
package main
import (
http "github.com/saucesteals/fhttp"
"github.com/saucesteals/mimic"
)
func main() {
transport, _ := mimic.NewTransport(mimic.TransportOptions{
Version: "137.0.0.0",
Brand: mimic.BrandChrome, // or mimic.BrandBrave, mimic.BrandEdge
Platform: mimic.PlatformWindows, // or mimic.PlatformMac, mimic.PlatformLinux
Transport: &http.Transport{Proxy: http.ProxyFromEnvironment},
})
client := &http.Client{Transport: transport}
req, _ := http.NewRequest(http.MethodGet, "https://tls.peet.ws/api/clean", nil)
req.Header.Add("rtt", "50")
req.Header.Add("accept", "text/html,*/*")
req.Header.Add("x-requested-with", "XMLHttpRequest")
req.Header.Add("downlink", "3.9")
req.Header.Add("ect", "4g")
req.Header.Add("sec-fetch-site", "same-origin")
req.Header.Add("sec-fetch-mode", "cors")
req.Header.Add("sec-fetch-dest", "empty")
req.Header.Add("accept-encoding", "gzip, deflate, br")
req.Header.Add("accept-language", "en,en_US;q=0.9")
// mimic automatically sets: user-agent, sec-ch-ua, sec-ch-ua-mobile, sec-ch-ua-platform
// optional header order
// req.Header[http.HeaderOrderKey] = []string{
// "user-agent", "sec-ch-ua", "sec-ch-ua-mobile", ...
// }
res, _ := client.Do(req)
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
```