@@ -2,14 +2,11 @@ package utils
2
2
3
3
import (
4
4
"context"
5
- "crypto/tls"
6
5
"encoding/json"
7
6
"fmt"
8
7
"log"
9
8
"net"
10
9
"net/http"
11
- "net/http/httptrace"
12
- "net/textproto"
13
10
"sync"
14
11
15
12
"github.com/go-errors/errors"
@@ -79,59 +76,6 @@ func ResolveCNAME(ctx context.Context, host string) (string, error) {
79
76
return "" , errors .Errorf ("failed to locate appropriate CNAME record for %s; resolves to %+v" , host , serialized )
80
77
}
81
78
82
- func WithTraceContext (ctx context.Context ) context.Context {
83
- trace := & httptrace.ClientTrace {
84
- DNSStart : func (info httptrace.DNSStartInfo ) {
85
- log .Printf ("DNS Start: %+v\n " , info )
86
- },
87
- DNSDone : func (info httptrace.DNSDoneInfo ) {
88
- if info .Err != nil {
89
- log .Println ("DNS Error:" , info .Err )
90
- } else {
91
- log .Printf ("DNS Done: %+v\n " , info )
92
- }
93
- },
94
- ConnectStart : func (network , addr string ) {
95
- log .Println ("Connect Start:" , network , addr )
96
- },
97
- ConnectDone : func (network , addr string , err error ) {
98
- if err != nil {
99
- log .Println ("Connect Error:" , network , addr , err )
100
- } else {
101
- log .Println ("Connect Done:" , network , addr )
102
- }
103
- },
104
- TLSHandshakeStart : func () {
105
- log .Println ("TLS Start" )
106
- },
107
- TLSHandshakeDone : func (cs tls.ConnectionState , err error ) {
108
- if err != nil {
109
- log .Println ("TLS Error:" , err )
110
- } else {
111
- log .Printf ("TLS Done: %+v\n " , cs )
112
- }
113
- },
114
- WroteHeaderField : func (key string , value []string ) {
115
- log .Println ("Sent Header:" , key , value )
116
- },
117
- WroteRequest : func (wr httptrace.WroteRequestInfo ) {
118
- if wr .Err != nil {
119
- log .Println ("Send Error:" , wr .Err )
120
- } else {
121
- log .Println ("Send Done" )
122
- }
123
- },
124
- Got1xxResponse : func (code int , header textproto.MIMEHeader ) error {
125
- log .Println ("Recv 1xx:" , code , header )
126
- return nil
127
- },
128
- GotFirstResponseByte : func () {
129
- log .Println ("Recv First Byte" )
130
- },
131
- }
132
- return httptrace .WithClientTrace (ctx , trace )
133
- }
134
-
135
79
type DialContextFunc func (context.Context , string , string ) (net.Conn , error )
136
80
137
81
// Wraps a DialContext with DNS-over-HTTPS as fallback resolver
0 commit comments