Simple HTTP tracer using builtin httptrace
package.
go get -u github.com/Navid2zp/httptracer
result, err := httptracer.Trace("https://google.com", "GET")
fmt.Println("Error: ", err)
fmt.Println("Name Lookup: ", result.NameLookup)
fmt.Println("Connect: ", result.Connect)
fmt.Println("TLS Handshake: ", result.TLSHandshake)
fmt.Println("First Byte: ", result.FirstByte)
fmt.Println("Full Response: ", result.FullResponse)
fmt.Println("Body Size (byte): ", result.BodySize)
You can convert results to JSON or XML easier using these methods.
// Returns json encoded bytes
jsonData, _ := result.ToJSON()
fmt.Println(string(jsonData))
// Returns xml encoded bytes
xmlData, _ := result.ToXML()
fmt.Println(string(xmlData))