An open API service indexing awesome lists of open source software.

https://github.com/navid2zp/httptracer

Simple HTTP tracer in Go
https://github.com/navid2zp/httptracer

golang http httptracer trace tracer tracing

Last synced: 7 months ago
JSON representation

Simple HTTP tracer in Go

Awesome Lists containing this project

README

          

# httptracer

Simple HTTP tracer using builtin `httptrace` package.

## Install/Update

```
go get -u github.com/Navid2zp/httptracer
```

### Example

```go
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)
```

#### Methods

You can convert results to JSON or XML easier using these methods.

```go
// Returns json encoded bytes
jsonData, _ := result.ToJSON()
fmt.Println(string(jsonData))

// Returns xml encoded bytes
xmlData, _ := result.ToXML()
fmt.Println(string(xmlData))
```