NOTE: Guide to
net/http
timeouts
Also, here are some Transport settings you might want.
Although not explicitly stated, DNS resolution appears to be taken into consideration as part of the overall http.Client.Timeout
setting. If you need to set your own DNS timeout, then it seems https://github.com/miekg/dns is a popular solution.
Additionally, it's important to realise how golang resolves hostnames to IPs (i.e. DNS resolution):
https://golang.org/pkg/net/#hdr-Name_Resolution
When cross-compiling binaries you'll find that CGO is typically disabled in favour of the native Go resolver. You can enforce CGO or native like so:
env GODEBUG=netdns=cgo+2 go run main.go
env GODEBUG=netdns=go+2 go run main.go
Yeah, appending makes sense but probably I'm gonna put some OTel spans inside it so the last error will be enough!
Talking about the truncation issue, I could just create another "dns.Client" setting the "Net" attribute to "tcp", right?