Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exported go function cycletls.NewTransport() #286

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

deoxykev
Copy link
Contributor

This PR addresses #151

The idea is to be able to export the http.Client Transport, so we are able to use CycleTLS in our own http.Clients.

There are two new Exported functions:

  • NewTransport()
  • NewTransportWithProxy

Example Usage:

import (
	"github.com/Danny-Dasilva/CycleTLS/cycletls"
	http "github.com/Danny-Dasilva/fhttp" // note this is a drop-in replacement for net/http
)

func main() {
	ja3 := "771,52393-52392-52244-52243-49195-49199-49196-49200-49171-49172-156-157-47-53-10,65281-0-23-35-13-5-18-16-30032-11-10,29-23-24,0"
	ua := "Chrome Version 57.0.2987.110 (64-bit) Linux"

 	 cycleClient := &http.Client{
 		Transport:     cycletls.NewTransport(ja3, ua),
 	 }

	resp, err := cycleClient.Get("https://tls.peet.ws/")
	...
}

The caveat here is having to use the drop-in replacement for net/http: github.com/Danny-Dasilva/fhttp everywhere net/http is used. But in my testing, it seems to work well.

… http.Client transport, for use with a custom http.client.
@Danny-Dasilva
Copy link
Owner

Nice, I'll get this merged in

@deoxykev
Copy link
Contributor Author

Thanks for all your work on this library, I really appreciate it.

@Danny-Dasilva Danny-Dasilva merged commit 4df48e6 into Danny-Dasilva:main Nov 28, 2023
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants