Source File
trace.go
Belonging Package
net/http/httptrace
package httptrace
import (
)
type clientEventContextKey struct{}
func ( context.Context) *ClientTrace {
, := .Value(clientEventContextKey{}).(*ClientTrace)
return
}
func ( context.Context, *ClientTrace) context.Context {
if == nil {
panic("nil trace")
}
:= ContextClientTrace()
.compose()
= context.WithValue(, clientEventContextKey{}, )
if .hasNetHooks() {
:= &nettrace.Trace{
ConnectStart: .ConnectStart,
ConnectDone: .ConnectDone,
}
if .DNSStart != nil {
.DNSStart = func( string) {
.DNSStart(DNSStartInfo{Host: })
}
}
if .DNSDone != nil {
.DNSDone = func( []interface{}, bool, error) {
:= make([]net.IPAddr, len())
for , := range {
[] = .(net.IPAddr)
}
.DNSDone(DNSDoneInfo{
Addrs: ,
Coalesced: ,
Err: ,
})
}
}
= context.WithValue(, nettrace.TraceKey{}, )
}
return
}
GotConn func(GotConnInfo)
PutIdleConn func(err error)
GotFirstResponseByte func()
Got100Continue func()
Got1xxResponse func(code int, header textproto.MIMEHeader) error
DNSStart func(DNSStartInfo)
DNSDone func(DNSDoneInfo)
ConnectStart func(network, addr string)
ConnectDone func(network, addr string, err error)
TLSHandshakeStart func()
TLSHandshakeDone func(tls.ConnectionState, error)
WroteHeaderField func(key string, value []string)
WroteHeaders func()
Wait100Continue func()
WroteRequest func(WroteRequestInfo)
}
type DNSStartInfo struct {
Host string
}
Coalesced bool
}
func ( *ClientTrace) () bool {
if == nil {
return false
}
return .DNSStart != nil || .DNSDone != nil || .ConnectStart != nil || .ConnectDone != nil
}
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |