Skip to content

Commit

Permalink
Set custom TLS configuration with minimum TLS 1.2 to all request hand…
Browse files Browse the repository at this point in the history
…ling methods
  • Loading branch information
ibnaleem authored Nov 20, 2024
1 parent 1d36406 commit 6efbf8a
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions gosearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"sync"
"github.com/inancgumus/screen"
"gopkg.in/yaml.v3"
"crypto/tls"
)

var Reset = "\033[0m"
Expand Down Expand Up @@ -109,7 +110,16 @@ func BuildURL(baseURL, username string) string {
func MakeRequestWithCookies(url string, cookies [] Cookie, WebsiteErrorCode int, wg *sync.WaitGroup) {
defer wg.Done()

client := &http.Client{}
transport := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}

client := &http.Client{
Transport: transport,
}

req, err := http.NewRequest("GET", url, nil)

if err != nil {
Expand Down Expand Up @@ -143,7 +153,16 @@ func MakeRequestWithCookies(url string, cookies [] Cookie, WebsiteErrorCode int,
func MakeRequestWithCookiesAndErrorMsg(website Website, url string, cookies [] Cookie, errorMsg string, username string, wg *sync.WaitGroup) {
defer wg.Done()

client := &http.Client{}
transport := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}

client := &http.Client{
Transport: transport,
}

req, err := http.NewRequest("GET", url, nil)

if err != nil {
Expand Down Expand Up @@ -188,7 +207,16 @@ func MakeRequestWithCookiesAndErrorMsg(website Website, url string, cookies [] C
func MakeRequestWithoutErrorMsg(url string, WebsiteErrorCode int, wg *sync.WaitGroup) {
defer wg.Done()

client := &http.Client{}
transport := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}

client := &http.Client{
Transport: transport,
}

req, err := http.NewRequest("GET", url, nil)

if err != nil {
Expand All @@ -215,7 +243,16 @@ func MakeRequestWithoutErrorMsg(url string, WebsiteErrorCode int, wg *sync.WaitG
func MakeRequestWithErrorMsg(website Website, url string, errorMsg string, username string, wg *sync.WaitGroup) {
defer wg.Done()

client := &http.Client{}
transport := &http.Transport{
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
},
}

client := &http.Client{
Transport: transport,
}

req, err := http.NewRequest("GET", url, nil)

if err != nil {
Expand Down Expand Up @@ -302,4 +339,4 @@ func main() {

Search(config, username)
os.Exit(0)
}
}

0 comments on commit 6efbf8a

Please sign in to comment.