@@ -44,7 +44,7 @@ type direct struct {
44
44
}
45
45
46
46
func Configure (pool * x509.CertPool , masquerades map [string ][]* Masquerade , cacheFile string ) {
47
- log .Debug ("Configuring fronted" )
47
+ log .Trace ("Configuring fronted" )
48
48
if masquerades == nil || len (masquerades ) == 0 {
49
49
log .Errorf ("No masquerades!!" )
50
50
return
@@ -103,7 +103,7 @@ func (d *direct) loadCandidates(initial map[string][]*Masquerade) {
103
103
}
104
104
105
105
func (d * direct ) vetInitial (numberToVet int ) {
106
- log .Debugf ("Vetting %d initial candidates in parallel" , numberToVet )
106
+ log .Tracef ("Vetting %d initial candidates in parallel" , numberToVet )
107
107
for i := 0 ; i < numberToVet ; i ++ {
108
108
go d .vetOne ()
109
109
}
@@ -194,26 +194,26 @@ func (d *direct) dialWith(in chan *Masquerade, network string) (net.Conn, bool,
194
194
}
195
195
}
196
196
197
- log .Debugf ("Dialing to %v" , m )
197
+ log .Tracef ("Dialing to %v" , m )
198
198
199
199
// We do the full TLS connection here because in practice the domains at a given IP
200
200
// address can change frequently on CDNs, so the certificate may not match what
201
201
// we expect.
202
202
if conn , err := d .dialServerWith (m ); err != nil {
203
- log .Debugf ("Could not dial to %v, %v" , m .IpAddress , err )
203
+ log .Tracef ("Could not dial to %v, %v" , m .IpAddress , err )
204
204
// Don't re-add this candidate if it's any certificate error, as that
205
205
// will just keep failing and will waste connections. We can't access the underlying
206
206
// error at this point so just look for "certificate" and "handshake".
207
207
if strings .Contains (err .Error (), "certificate" ) || strings .Contains (err .Error (), "handshake" ) {
208
- log .Debugf ("Not re-adding candidate that failed on error '%v'" , err .Error ())
208
+ log .Tracef ("Not re-adding candidate that failed on error '%v'" , err .Error ())
209
209
} else {
210
- log .Debugf ("Unexpected error dialing, keeping masquerade: %v" , err )
210
+ log .Tracef ("Unexpected error dialing, keeping masquerade: %v" , err )
211
211
retryLater = append (retryLater , m )
212
212
}
213
213
} else {
214
- log .Debugf ("Got successful connection to: %v" , m )
214
+ log .Tracef ("Got successful connection to: %v" , m )
215
215
if err := d .headCheck (m ); err != nil {
216
- log .Debugf ("Could not perform successful head request: %v" , err )
216
+ log .Tracef ("Could not perform successful head request: %v" , err )
217
217
} else {
218
218
// Requeue the working connection to masquerades
219
219
d .masquerades <- m
@@ -226,14 +226,14 @@ func (d *direct) dialWith(in chan *Masquerade, network string) (net.Conn, bool,
226
226
}
227
227
idleTimeout := 70 * time .Second
228
228
229
- log .Debug ("Wrapping connecting in idletiming connection" )
229
+ log .Trace ("Wrapping connecting in idletiming connection" )
230
230
conn = idletiming .Conn (conn , idleTimeout , func () {
231
- log .Debugf ("Connection to %v idle for %v, closing" , conn .RemoteAddr (), idleTimeout )
231
+ log .Tracef ("Connection to %v idle for %v, closing" , conn .RemoteAddr (), idleTimeout )
232
232
if err := conn .Close (); err != nil {
233
- log .Debugf ("Unable to close connection: %v" , err )
233
+ log .Tracef ("Unable to close connection: %v" , err )
234
234
}
235
235
})
236
- log .Debug ("Returning connection" )
236
+ log .Trace ("Returning connection" )
237
237
return conn , true , nil
238
238
}
239
239
}
@@ -305,7 +305,7 @@ func (d *direct) headCheck(m *Masquerade) error {
305
305
if 200 != resp .StatusCode {
306
306
return fmt .Errorf ("Unexpected response status: %v, %v" , resp .StatusCode , resp .Status )
307
307
}
308
- log .Debugf ("Successfully passed HEAD request through: %v" , m )
308
+ log .Tracef ("Successfully passed HEAD request through: %v" , m )
309
309
return nil
310
310
}
311
311
0 commit comments