Package: cycletls
CycleTLS PythonCurrently a WIP and in Active development. See theTab for more infoIf you have a API change or feature request feel free to open an Issue🚀 FeaturesHigh-performanceBuilt-in goroutine pool used for handling asynchronous requestsCustom header ordering via fhttpProxy supportJa3 Token configurationRequest Redirection toggleTable of contentsTable of contentsInstallationUsageQuickStart JSQuickstart GolangInitializing CycleTLSAPI/MethodsRequest ConfigResponse SchemaMultiple Requests ExampleDev SetupLICENSEFor any feature requests or API change requests, please feel free to open an issue.Dependenciesnode ^v14.0
golang ^v1.16xInstallation$npminstallcycletlsUsageExample CycleTLS Request for Typescript and JavascriptYou can run this test intests/simple.test.tsconstinitCycleTLS=require('cycletls');// Typescript: import initCycleTLS from 'cycletls';(async()=>{// Initiate CycleTLSconstcycleTLS=awaitinitCycleTLS();// Send requestconstresponse=awaitcycleTLS('https://ja3er.com/json',{body:'',ja3:'771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0',userAgent:'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0',proxy:'http://username:password@hostname.com:443'},'get');console.log(response);// Cleanly exit CycleTLScycleTLS.exit();})();Example CycleTLS Request for Golangpackagemainimport("log""github.com/Danny-Dasilva/CycleTLS/cycletls")funcmain(){client:=cycletls.Init()response,err:=client.Do("https://ja3er.com/json",cycletls.Options{Body:"",Ja3:"771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0",UserAgent:"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0",},"GET");iferr!=nil{log.Print("Request Failed: "+err.Error())}log.Println(response)}Creating an instanceIn order to create acycleTLSinstance, you can run the following:JavaScript// The initCycleTLS function spawns a Golang process that handles all requests concurrently via goroutine loops.constinitCycleTLS=require('cycletls');// import initCycleTLS from 'cycletls';// Async/Await methodconstcycleTLS=awaitinitCycleTLS();// .then methodinitCycleTLS().then((cycleTLS)=>{});Golangimport("github.com/Danny-Dasilva/CycleTLS/cycletls")//The `Init` function initializes golang channels to process requests.client:=cycletls.Init()CycleTLS Alias MethodsThe following methods exist in CycleTLScycleTLS([url], config)cycleTLS.get([url], config)cycleTLS.delete([url], config)cycleTLS.head([url], config)cycleTLS.options([url], config)cycleTLS.post([url], config)cycleTLS.put([url], config)cycleTLS.patch([url], config)If URL is not passed, one must be specified in the config.CycleTLS Request Config{// URL for the request (required if not specified as an argument)url:"https://example.com"// Method for the request ("head" | "get" | "post" | "put" | "delete" | "trace" | "options" | "connect" | "patch")method:"get"// Default method// Custom headers to sendheaders:{"Authorization":"Bearer someexampletoken"}// Custom cookies to sendCookies:[{"name":"key","value":"val","path":"/docs","domain":"google.com","expires":"Mon, 02-Jan-2022 15:04:05 EST""maxAge":90,"secure":false,"httpOnly":true,"sameSite":"Lax"}],// Body to send with request (must be a string - cannot pass an object)body:'',// JA3 token to send with requestja3:'771,4865-4867-4866-49195-49199-52393-52392-49196-49200-49162-49161-49171-49172-51-57-47-53-10,0-23-65281-10-11-35-16-5-51-43-13-45-28-21,29-23-24-25-256-257,0',// User agent for requestuserAgent:'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:87.0) Gecko/20100101 Firefox/87.0',// Proxy to send request through (must be in the same format)proxy:'http://username:password@hostname.com:443',// Amount of seconds before request timeout (default: 7)timeout:2,// Toggle if CycleTLS should follow redirectsdisableRedirect:true// Custom header order to send with request (This value will overwrite default header order)headerOrder:["cache-control","connection","host"]});CycleTLS Response Schema{// Status code returned from server (Number)status:200,// Body returned from the server (String)body:"",// Headers returned from the server (Object)headers:{"some":"header",...}});Multiple Requests Example for Typescript and JavascriptIf CycleTLS is being used by in a JavaScript environment, CycleTLS will spawn a Golang process to handle requests. This Golang process handles requestsconcurrentlyin a worker pool. Due to this, CycleTLS returns response objects as soon as they are made available
(in other terms, CycleTLS processes requests as they are received, but responses are returned asynchronously so they will NOT be returned in the order requested)If you are using CycleTLS in JavaScript, it is necessary to exit out of the instance to prevent zombie processes. The example below shows one way to approach cleanly exiting CycleTLS if you need to process multiple requests (note: keep in mind that calling theexit()function will kill any requests in progress). If your workflow requires requests running the entire time the process runs, modules such asexit-hookcould serve as an alternative solution to cleanly exiting CycleTLS.constinitCycleTLS=require("cycletls");// Typescript: import initCycleTLS from 'cycletls';// Defining custom JA3 token and user agenton multiple requests,"https://httpbin.org/user-agent":{ja3:ja3,userAgent:userAgent,},"http://httpbin.org/post":{body:'{"field":"POST-VAL"}',method:"POST",},"http://httpbin.org/cookies":{cookies:[{name:"example1",value:"aaaaaaa",expires:"Mon, 02-Jan-2022 15:04:05 EST",},],},};// Promises array of requestsconstpromises=[];// Anonymous async function(async()=>{// Initiate CycleTLSconstcycleTLS=awaitinitCycleTLS();// Loop through requestDict (Object) defined abovefor(consturlinrequestDict){// Fetch configs from requestDict (Object)constparams=requestDict[url];// Send request (note: no waiting)constresponse=cycleTLS(url,{body:params.body??"",//?? is just setting defaults in this caseja3:params.ja3??ja3,userAgent:params.userAgent??userAgent,headers:params.headers,cookies:params.cookies,},params.method??"GET");// console.log the response objectresponse.then((out)=>{console.log(url,out);});// Push request to promise arraypromises.push(response);}// Wait for all requests to execute successfullyPromise.all(promises).then(()=>{// Cleanly exit CycleTLS one all requests have been receivedcycleTLS.exit();});})();Dev SetupIf you would like to compile CycleTLS on your own, use the following commands:Set module-aware modego env -w  GO111MODULE=autoInstall golang dependenciesgo get github.com/Danny-Dasilva/CycleTLS/cycletlsinstall npm packagesnpm installTo recompile index.ts in the src foldernpm run buildTo recompile Golang files in the golang folderWindowsnpm run build:windowsLinuxnpm run build:linuxMacnpm run build:mac:LICENSEGPL3 LICENSE SYNOPSISTL;DR* Here's what the GPL3 license entails:1.Anyone can copy, modify and distribute this software.2.You have to include the license and copyright notice with each and every distribution.3.You can use this software privately.4.You can use this software for commercial purposes.5.Source code MUST be made available when the software is distributed.6.Any modifications of this code base MUST be distributed with the same license, GPLv3.7.This software is provided without warranty.8.The software author or license can not be held liable for any damages inflicted by the software.More information on about theLICENSE can be found here