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

Version 1.6 #6

Merged
merged 27 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c35e858
refs #57: fixed possible nil pointer in error case when working with …
bogdanfinn Jun 16, 2023
0a858d6
fixed manual call of CloseIdleConnections and fixed overriting of pro…
bogdanfinn Jul 4, 2023
d4615cf
fixed outgoing cookie expires json field to be integer not string;
bogdanfinn Jul 29, 2023
86a9768
refs #59: added transport options to shared library payload;
bogdanfinn Jul 29, 2023
20255e9
refs #61: added wildcard support for certificate pinning;
bogdanfinn Jul 29, 2023
11b1480
refs #45: used xgo to prebuilt linux arm shared libraries and created…
bogdanfinn Jul 29, 2023
e35d465
fixed shared library version in examples;
bogdanfinn Jul 29, 2023
7512bd3
fixed shared library to use latest tls client;
bogdanfinn Jul 30, 2023
a5ea8cb
Fixed Custom Redirect being used regardless if followRedirect is false
Aug 5, 2023
299484f
refs #68: implemented default header option for client;
bogdanfinn Aug 15, 2023
68f4942
adjusted build.sh script to run on ubuntu;
bogdanfinn Aug 27, 2023
61954d8
added serverNameOverwrite option to shared library payload;
bogdanfinn Aug 27, 2023
a82dd73
updated fhttp dependency;
bogdanfinn Aug 27, 2023
a2937f0
added default headers option to shared library payload;
bogdanfinn Aug 27, 2023
a73bee0
built shared libraries with newest version;
bogdanfinn Sep 3, 2023
1b6c4cf
added firefox117 profile;
bogdanfinn Sep 17, 2023
eba9f13
updated typescript example;
bogdanfinn Sep 21, 2023
716d7b1
added chrome 117 with changed h2 fingerprint;
bogdanfinn Sep 21, 2023
fab71d2
updated shared library to 1.6.1;
bogdanfinn Sep 21, 2023
93e3143
updated readme;
bogdanfinn Sep 21, 2023
e5324c4
Add safari profile
josh-pinwheelapi Sep 24, 2023
28efc52
Generate shared libraries
josh-pinwheelapi Sep 24, 2023
fa7f0f2
Genereate shared library for monterey
josh-pinwheelapi Sep 24, 2023
55926a2
Profile change
josh-pinwheelapi Sep 24, 2023
63d9f5a
Generate Ventura shared libraries
josh-pinwheelapi Sep 24, 2023
1d00053
Update shared libraries
josh-pinwheelapi Sep 24, 2023
45e2b90
Merge branch 'master' of https://github.com/underdog-tech/tls-client-…
josh-pinwheelapi Sep 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ cffi_dist/example_node/package-lock.json
cffi_dist/example_node/index_ftl_cookies.js
cffi_dist/example_node/index_nike_cookies.js
cffi_dist/example_node/node_modules
examples_externals
.DS_Store
.DS_Store
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ import (

http "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client"
"github.com/bogdanfinn/tls-client/profiles"
)

func main() {
jar := tls_client.NewCookieJar()
options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(30),
tls_client.WithClientProfile(tls_client.Chrome_105),
tls_client.WithClientProfile(profiles.Chrome_105),
tls_client.WithNotFollowRedirects(),
tls_client.WithCookieJar(jar), // create cookieJar instance and pass it as argument
}
Expand Down
2 changes: 1 addition & 1 deletion cffi_dist/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apt-get update -y -q && apt-get upgrade -y -q
RUN apt-get install --no-install-recommends -y -q curl build-essential ca-certificates git gcc g++ bash

# Download Go 1.18 and install it to /usr/local/go
RUN curl -s https://dl.google.com/go/go1.18.3.linux-amd64.tar.gz | tar -v -C /usr/local -xz
RUN curl -s https://dl.google.com/go/go1.20.linux-amd64.tar.gz | tar -v -C /usr/local -xz

# Let's people find our Go binaries
ENV PATH $PATH:/usr/local/go/bin
2 changes: 1 addition & 1 deletion cffi_dist/Dockerfile.alpine.compile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-alpine3.16
FROM golang:1.20-alpine3.16
RUN apk add --no-cache \
git \
gcc \
Expand Down
13 changes: 0 additions & 13 deletions cffi_dist/Dockerfile.ubuntu.compile

This file was deleted.

36 changes: 32 additions & 4 deletions cffi_dist/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,41 @@
echo 'Build OSX'
GOOS=darwin CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o ./dist/tls-client-darwin-arm64-ventura.dylib
GOOS=darwin CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o ./dist/tls-client-darwin-amd64-ventura.dylib
#GOOS=darwin CGO_ENABLED=1 GOARCH=arm64 go build -buildmode=c-shared -o ./dist/tls-client-darwin-arm64-.dylib
#GOOS=darwin CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o ./dist/tls-client-darwin-amd64-.dylib

# echo 'Build Linux ARM64'
# # CC is needed when you cross compile from OSX to Linux
# # On Macos:
# # GOOS=linux CGO_ENABLED=1 GOARCH=arm64 CC="aarch64-unknown-linux-gnu-gcc" go build -buildmode=c-shared -o ./dist/tls-client-linux-arm64-$1.so

# # On Linux:
# GOOS=linux CGO_ENABLED=1 GOARCH=arm64 CC="aarch64-linux-gnu-gcc" go build -buildmode=c-shared -o ./dist/tls-client-linux-arm64-$1.so

# echo 'Build Linux ARMv7'
# # CC is needed when you cross compile from OSX to Linux
# GOOS=linux CGO_ENABLED=1 GOARCH=arm CC="armv7-linux-gnueabihf-gcc" go build -buildmode=c-shared -o ./dist/tls-client-linux-armv7-$1.so

# # CC is needed when you cross compile from OSX to Linux
# echo 'Build Linux Alpine'
# # For some reason my OSX gcc cross compiler does not work. Therefore i use a alpine docker image
# # GOOS=linux CGO_ENABLED=1 GOARCH=amd64 CC="x86_64-linux-musl-gcc" go build -buildmode=c-shared -o ./dist/tls-client-linux-amd64.so
# # Make sure to first build the image based on the Dockerfile.alpine.compile in this directory.
# docker run -v $PWD/../:/tls-client tls-client-alpine-go-1.20 bash -c "cd /tls-client/cffi_dist && GOOS=linux CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o /tls-client/cffi_dist/dist/tls-client-linux-alpine-amd64-$1.so"

# CC is needed when you cross compile from OSX to Linux
echo 'Build Linux Ubuntu'
# For some reason my OSX gcc cross compiler does not work. Therefore i use a ubuntu docker image
# GOOS=linux CGO_ENABLED=1 GOARCH=amd64 CC="x86_64-linux-musl-gcc" go build -buildmode=c-shared -o ./dist/tls-client-linux-amd64.so
# Make sure to first build the image based on the Dockerfile.ubuntu.compile in this directory.
# docker build . -t tls-client tls-client-ubuntu-go-1.18
docker run --platform linux/x86_64 -v $PWD/../:/tls-client tls-client-ubuntu-go-1.18 bash -c "cd /tls-client/cffi_dist && GOOS=linux CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o /tls-client/cffi_dist/dist/tls-client-linux-ubuntu-amd64.so"
docker run -v $PWD/../:/tls-client tls-client-ubuntu-go-1.20 bash -c "cd /tls-client/cffi_dist && GOOS=linux CGO_ENABLED=1 GOARCH=amd64 go build -buildmode=c-shared -o /tls-client/cffi_dist/dist/tls-client-linux-ubuntu-amd64-$1.so"


# # CC is needed when you cross compile from OSX to Windows
# echo 'Build Windows 32 Bit'
# GOOS=windows CGO_ENABLED=1 GOARCH=386 CC="i686-w64-mingw32-gcc" go build -buildmode=c-shared -o ./dist/tls-client-windows-32-$1.dll

# # CC is needed when you cross compile from OSX to Windows
# echo 'Build Windows 64 Bit'
# GOOS=windows CGO_ENABLED=1 GOARCH=amd64 CC="x86_64-w64-mingw32-gcc" go build -buildmode=c-shared -o ./dist/tls-client-windows-64-$1.dll

# echo 'Build with xgo'
# xgo -buildmode=c-shared -out dist/tls-client-xgo-$1 .
Binary file added cffi_dist/dist/tls-client-darwin-amd64-.dylib
Binary file not shown.
91 changes: 91 additions & 0 deletions cffi_dist/dist/tls-client-darwin-amd64-.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package tls_client_cffi */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h>

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments. */


#line 3 "main.go"

#include <stdlib.h>

#line 1 "cgo-generated-wrapper"


/* End of preamble from import "C" comments. */


/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif

/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue. */

#ifdef __cplusplus
extern "C" {
#endif

extern void freeMemory(char* responseId);
extern char* destroyAll();
extern char* destroySession(char* destroySessionParams);
extern char* getCookiesFromSession(char* getCookiesParams);
extern char* addCookiesToSession(char* addCookiesParams);
extern char* request(char* requestParams);

#ifdef __cplusplus
}
#endif
Binary file not shown.
91 changes: 91 additions & 0 deletions cffi_dist/dist/tls-client-darwin-amd64-ventura.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package tls_client_cffi */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h>

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments. */


#line 3 "main.go"

#include <stdlib.h>

#line 1 "cgo-generated-wrapper"


/* End of preamble from import "C" comments. */


/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif

/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue. */

#ifdef __cplusplus
extern "C" {
#endif

extern void freeMemory(char* responseId);
extern char* destroyAll();
extern char* destroySession(char* destroySessionParams);
extern char* getCookiesFromSession(char* getCookiesParams);
extern char* addCookiesToSession(char* addCookiesParams);
extern char* request(char* requestParams);

#ifdef __cplusplus
}
#endif
Binary file added cffi_dist/dist/tls-client-darwin-arm64-.dylib
Binary file not shown.
91 changes: 91 additions & 0 deletions cffi_dist/dist/tls-client-darwin-arm64-.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package tls_client_cffi */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h>

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif

#endif

/* Start of preamble from import "C" comments. */


#line 3 "main.go"

#include <stdlib.h>

#line 1 "cgo-generated-wrapper"


/* End of preamble from import "C" comments. */


/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif

/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue. */

#ifdef __cplusplus
extern "C" {
#endif

extern void freeMemory(char* responseId);
extern char* destroyAll();
extern char* destroySession(char* destroySessionParams);
extern char* getCookiesFromSession(char* getCookiesParams);
extern char* addCookiesToSession(char* addCookiesParams);
extern char* request(char* requestParams);

#ifdef __cplusplus
}
#endif
Binary file not shown.
Loading