-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81ff1e6
commit 890bb30
Showing
3 changed files
with
81 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,23 +34,50 @@ func TestProxySuccess(t *testing.T) { | |
} | ||
log.Print("Body: " + resp.Body) | ||
} | ||
func TestSocks4Proxy(t *testing.T) { | ||
if runtime.GOOS != "linux" { | ||
t.Skip("Skipping this test on non-linux platforms") | ||
return | ||
} | ||
client := cycletls.Init() | ||
resp, err := client.Do("https://ipinfo.io/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", | ||
Proxy: "socks4://abc:[email protected]:1087", | ||
Headers: map[string]string{ | ||
"Accept": "Application/json, text/plain, */*", | ||
}, | ||
}, "GET") | ||
if err != nil { | ||
t.Fatalf("Request Failed: " + err.Error()) | ||
} | ||
if resp.Status != 200 { | ||
t.Fatalf("Expected %d Got %d for Status", 200, resp.Status) | ||
} | ||
log.Print("Body: " + resp.Body) | ||
} | ||
|
||
// func TestHttpError(t *testing.T) { | ||
|
||
// client := cycletls.Init() | ||
// resp, err := client.Do("https://ipinfo.io/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", | ||
// Proxy: "http://127.0.0.1:10809", | ||
// Headers: map[string]string{ | ||
// "Accept": "Application/json, text/plain, */*", | ||
// }, | ||
// }, "GET") | ||
// if err != nil { | ||
// log.Print("Request Failed: " + err.Error()) | ||
// } | ||
// log.Print("Status: " + strconv.Itoa(resp.Status)) | ||
// log.Print("Body: " + resp.Body) | ||
|
||
// } | ||
func TestSocks5hProxy(t *testing.T) { | ||
if runtime.GOOS != "linux" { | ||
t.Skip("Skipping this test on non-linux platforms") | ||
return | ||
} | ||
client := cycletls.Init() | ||
resp, err := client.Do("https://ipinfo.io/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", | ||
Proxy: "socks5h://abc:[email protected]:1087", | ||
Headers: map[string]string{ | ||
"Accept": "Application/json, text/plain, */*", | ||
}, | ||
}, "GET") | ||
if err != nil { | ||
t.Fatalf("Request Failed: " + err.Error()) | ||
} | ||
if resp.Status != 200 { | ||
t.Fatalf("Expected %d Got %d for Status", 200, resp.Status) | ||
} | ||
log.Print("Body: " + resp.Body) | ||
} |