|
@@ -163,7 +163,7 @@ next:
|
|
|
// because there are implementations out there that don't support
|
|
|
// protocol negotiation (iOS for one...).
|
|
|
if !cs.NegotiatedProtocolIsMutual || cs.NegotiatedProtocol != s.bepProtocolName {
|
|
|
- l.Infof("Peer %s did not negotiate bep/1.0", c.RemoteAddr())
|
|
|
+ l.Infof("Peer at %s did not negotiate bep/1.0", c)
|
|
|
}
|
|
|
|
|
|
// We should have received exactly one certificate from the other
|
|
@@ -171,7 +171,7 @@ next:
|
|
|
// connection.
|
|
|
certs := cs.PeerCertificates
|
|
|
if cl := len(certs); cl != 1 {
|
|
|
- l.Infof("Got peer certificate list of length %d != 1 from %s; protocol error", cl, c.RemoteAddr())
|
|
|
+ l.Infof("Got peer certificate list of length %d != 1 from peer at %s; protocol error", cl, c)
|
|
|
c.Close()
|
|
|
continue
|
|
|
}
|
|
@@ -182,7 +182,7 @@ next:
|
|
|
// though, especially in the presence of NAT hairpinning, multiple
|
|
|
// clients between the same NAT gateway, and global discovery.
|
|
|
if remoteID == s.myID {
|
|
|
- l.Infof("Connected to myself (%s) - should not happen", remoteID)
|
|
|
+ l.Infof("Connected to myself (%s) at %s - should not happen", remoteID, c)
|
|
|
c.Close()
|
|
|
continue
|
|
|
}
|
|
@@ -206,7 +206,7 @@ next:
|
|
|
warningFor(remoteID, msg)
|
|
|
} else {
|
|
|
// It's something else - connection reset or whatever
|
|
|
- l.Infof("Failed to exchange Hello messages with %s (%s): %s", remoteID, c.RemoteAddr(), err)
|
|
|
+ l.Infof("Failed to exchange Hello messages with %s at %s: %s", remoteID, c, err)
|
|
|
}
|
|
|
c.Close()
|
|
|
continue
|
|
@@ -256,7 +256,7 @@ next:
|
|
|
// Incorrect certificate name is something the user most
|
|
|
// likely wants to know about, since it's an advanced
|
|
|
// config. Warn instead of Info.
|
|
|
- l.Warnf("Bad certificate from %s (%v): %v", remoteID, c.RemoteAddr(), err)
|
|
|
+ l.Warnf("Bad certificate from %s at %s: %v", remoteID, c, err)
|
|
|
c.Close()
|
|
|
continue next
|
|
|
}
|
|
@@ -268,11 +268,10 @@ next:
|
|
|
wr := s.limiter.newWriteLimiter(c, isLAN)
|
|
|
rd := s.limiter.newReadLimiter(c, isLAN)
|
|
|
|
|
|
- name := fmt.Sprintf("%s-%s (%s)", c.LocalAddr(), c.RemoteAddr(), c.Type())
|
|
|
- protoConn := protocol.NewConnection(remoteID, rd, wr, s.model, name, deviceCfg.Compression)
|
|
|
+ protoConn := protocol.NewConnection(remoteID, rd, wr, s.model, c.String(), deviceCfg.Compression)
|
|
|
modelConn := completeConn{c, protoConn}
|
|
|
|
|
|
- l.Infof("Established secure connection to %s at %s (%s)", remoteID, name, tlsCipherSuiteNames[c.ConnectionState().CipherSuite])
|
|
|
+ l.Infof("Established secure connection to %s at %s (%s)", remoteID, c, tlsCipherSuiteNames[c.ConnectionState().CipherSuite])
|
|
|
|
|
|
s.model.AddConnection(modelConn, hello)
|
|
|
continue next
|
|
@@ -779,11 +778,9 @@ func dialParallel(deviceID protocol.DeviceID, dialTargets []dialTarget) (interna
|
|
|
}()
|
|
|
|
|
|
// Wait for the first connection, or for channel closure.
|
|
|
- conn, ok := <-res
|
|
|
-
|
|
|
- // Got a connection, means more might come back, hence spawn a
|
|
|
- // routine that will do the discarding.
|
|
|
- if ok {
|
|
|
+ if conn, ok := <-res; ok {
|
|
|
+ // Got a connection, means more might come back, hence spawn a
|
|
|
+ // routine that will do the discarding.
|
|
|
l.Debugln("connected to", deviceID, prio, "using", conn, conn.priority)
|
|
|
go func(deviceID protocol.DeviceID, prio int) {
|
|
|
wg.Wait()
|
|
@@ -793,10 +790,9 @@ func dialParallel(deviceID protocol.DeviceID, dialTargets []dialTarget) (interna
|
|
|
}
|
|
|
}(deviceID, prio)
|
|
|
return conn, ok
|
|
|
- } else {
|
|
|
- // Failed to connect, report that fact.
|
|
|
- l.Debugln("failed to connect to", deviceID, prio)
|
|
|
}
|
|
|
+ // Failed to connect, report that fact.
|
|
|
+ l.Debugln("failed to connect to", deviceID, prio)
|
|
|
}
|
|
|
return internalConn{}, false
|
|
|
}
|