Need to implement TLS into a Golang HTTP Client (to send requests with)
€30-250 EUR
Closed
Posted over 3 years ago
€30-250 EUR
Paid on delivery
I need TLS implemented into a golang HTTP client used to sent HTTP requests outwards. It needs to be able to work with HTTP version 1.1 and 2, be able to use custom fingerprints (can be done inside the library uTLS) and have header order.
The ideal, and most likely easiest way to implement it, is by using this library: [login to view URL] in order to choose the fingerprints and such. However, if you have a better way, you can convince me.
Below was an attempt (failed attempt) of my own to show the sort of thing I need to do. (Probably best you do not go off my attempt, as it doesn't work, but it is just to show that I need to be able to send HTTP requests with it).
client := &[login to view URL]{
Transport: &[login to view URL]{
DialTLSContext: func(ctx [login to view URL], network, addr string) ([login to view URL], error) {
// Note that hardcoding the address is not necessary here. Only
// do that if you want to ignore the DNS lookup that already
// happened behind the scenes.
tcpConn, err := (&[login to view URL]{}).DialContext(ctx, network, addr)
if err != nil {
return nil, err
}
config := [login to view URL]{ServerName: "[login to view URL]"}
tlsConn := [login to view URL](tcpConn, &config, [login to view URL])
err = [login to view URL]()
if err != nil {
return nil, [login to view URL]("[login to view URL]() error: %w", err)
}
return tlsConn, nil
},
},
}
req, err := [login to view URL]("GET", "[login to view URL]", nil)
if err != nil {
[login to view URL](err)
return
}
[login to view URL]("authority", "[login to view URL]")
[login to view URL]("upgrade-insecure-requests", "1")
[login to view URL]("dnt", "1")
[login to view URL]("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36")
[login to view URL]("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
[login to view URL]("sec-fetch-site", "same-origin")
[login to view URL]("sec-fetch-mode", "navigate")
[login to view URL]("sec-fetch-user", "?1")
[login to view URL]("sec-fetch-dest", "document")
[login to view URL]("sec-ch-ua", "\"Chromium\";v=\"88\", \"Google Chrome\";v=\"88\", \";Not A Brand\";v=\"99\"")
[login to view URL]("sec-ch-ua-mobile", "?0")
[login to view URL]("referer", "[login to view URL]")
[login to view URL]("accept-language", "en-US,en;q=0.9,fr;q=0.8")
resp, err := [login to view URL](req)
if err != nil {
[login to view URL](err)
return
}
[login to view URL]()
if [login to view URL] != 403 {
[login to view URL]("Successful Request Sent!")
} else {
[login to view URL]("Request Forbidden")
}
It needs to successfully be able to send requests with the TLS handshake, without getting any errors.
Hello,
I think you missed a few http headers when you send the header. That's why the TL handshake got error. I could modify it for you in easy.
Best Regards,
Khamid