Fix capitalization of log messages

Log messages must start with an upper case letter
This commit is contained in:
Steffen Vogel
2023-04-20 22:15:07 +02:00
parent b37a5a34eb
commit ecfb354131
5 changed files with 31 additions and 31 deletions
+14 -14
View File
@@ -215,7 +215,7 @@ func (a *Agent) taskLoop() {
a.startedFn()
if err := a.buf.Close(); err != nil {
a.log.Warnf("failed to close buffer: %v", err)
a.log.Warnf("Failed to close buffer: %v", err)
}
a.closeMulticastConn()
@@ -323,9 +323,9 @@ func NewAgent(config *AgentConfig) (*Agent, error) { //nolint:gocognit
return nil, fmt.Errorf("failed to create network: %w", err)
}
} else if _, isVirtual := a.net.(*vnet.Net); isVirtual {
a.log.Warn("virtual network is enabled")
a.log.Warn("Virtual network is enabled")
if a.mDNSMode != MulticastDNSModeDisabled {
a.log.Warn("virtual network does not support mDNS yet")
a.log.Warn("Virtual network does not support mDNS yet")
}
}
@@ -656,7 +656,7 @@ func (a *Agent) AddRemoteCandidate(c Candidate) error {
// If we have a mDNS Candidate lets fully resolve it before adding it locally
if c.Type() == CandidateTypeHost && strings.HasSuffix(c.Address(), ".local") {
if a.mDNSMode == MulticastDNSModeDisabled {
a.log.Warnf("remote mDNS candidate added, but mDNS is disabled: (%s)", c.Address())
a.log.Warnf("Remote mDNS candidate added, but mDNS is disabled: (%s)", c.Address())
return nil
}
@@ -980,15 +980,15 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
if a.isControlling {
if m.Contains(stun.AttrICEControlling) {
a.log.Debug("inbound isControlling && a.isControlling == true")
a.log.Debug("Inbound STUN message: isControlling && a.isControlling == true")
return
} else if m.Contains(stun.AttrUseCandidate) {
a.log.Debug("useCandidate && a.isControlling == true")
a.log.Debug("Inbound STUN message: useCandidate && a.isControlling == true")
return
}
} else {
if m.Contains(stun.AttrICEControlled) {
a.log.Debug("inbound isControlled && a.isControlling == false")
a.log.Debug("Inbound STUN message: isControlled && a.isControlling == false")
return
}
}
@@ -996,22 +996,22 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
remoteCandidate := a.findRemoteCandidate(local.NetworkType(), remote)
if m.Type.Class == stun.ClassSuccessResponse {
if err = stun.MessageIntegrity([]byte(a.remotePwd)).Check(m); err != nil {
a.log.Warnf("discard message from (%s), %v", remote, err)
a.log.Warnf("Discard message from (%s), %v", remote, err)
return
}
if remoteCandidate == nil {
a.log.Warnf("discard success message from (%s), no such remote", remote)
a.log.Warnf("Discard success message from (%s), no such remote", remote)
return
}
a.selector.HandleSuccessResponse(m, local, remoteCandidate, remote)
} else if m.Type.Class == stun.ClassRequest {
if err = stunx.AssertUsername(m, a.localUfrag+":"+a.remoteUfrag); err != nil {
a.log.Warnf("discard message from (%s), %v", remote, err)
a.log.Warnf("Discard message from (%s), %v", remote, err)
return
} else if err = stun.MessageIntegrity([]byte(a.localPwd)).Check(m); err != nil {
a.log.Warnf("discard message from (%s), %v", remote, err)
a.log.Warnf("Discard message from (%s), %v", remote, err)
return
}
@@ -1038,7 +1038,7 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr)
}
remoteCandidate = prflxCandidate
a.log.Debugf("adding a new peer-reflexive candidate: %s ", remote)
a.log.Debugf("Adding a new peer-reflexive candidate: %s ", remote)
a.addRemoteCandidate(remoteCandidate)
}
@@ -1062,7 +1062,7 @@ func (a *Agent) validateNonSTUNTraffic(local Candidate, remote net.Addr) (Candid
remoteCandidate.seen(false)
}
}); err != nil {
a.log.Warnf("failed to validate remote candidate: %v", err)
a.log.Warnf("Failed to validate remote candidate: %v", err)
}
return remoteCandidate, remoteCandidate != nil
@@ -1099,7 +1099,7 @@ func (a *Agent) getSelectedPair() *CandidatePair {
func (a *Agent) closeMulticastConn() {
if a.mDNSConn != nil {
if err := a.mDNSConn.Close(); err != nil {
a.log.Warnf("failed to close mDNS Conn: %v", err)
a.log.Warnf("Failed to close mDNS Conn: %v", err)
}
}
}
+7 -7
View File
@@ -66,7 +66,7 @@ func (a *Agent) GatherCandidates() error {
func (a *Agent) gatherCandidates(ctx context.Context, done chan struct{}) {
defer close(done)
if err := a.setGatheringState(GatheringStateGathering); err != nil { //nolint:contextcheck
a.log.Warnf("failed to set gatheringState to GatheringStateGathering: %v", err)
a.log.Warnf("Failed to set gatheringState to GatheringStateGathering: %v", err)
return
}
@@ -110,7 +110,7 @@ func (a *Agent) gatherCandidates(ctx context.Context, done chan struct{}) {
wg.Wait()
if err := a.setGatheringState(GatheringStateComplete); err != nil { //nolint:contextcheck
a.log.Warnf("failed to set gatheringState to GatheringStateComplete: %v", err)
a.log.Warnf("Failed to set gatheringState to GatheringStateComplete: %v", err)
}
}
@@ -134,7 +134,7 @@ func (a *Agent) gatherCandidatesLocal(ctx context.Context, networkTypes []Networ
localIPs, err := localInterfaces(a.net, a.interfaceFilter, a.ipFilter, networkTypes, a.includeLoopback)
if err != nil {
a.log.Warnf("failed to iterate local interfaces, host candidates will not be gathered %s", err)
a.log.Warnf("Failed to iterate local interfaces, host candidates will not be gathered %s", err)
return
}
@@ -193,7 +193,7 @@ func (a *Agent) gatherCandidatesLocal(ctx context.Context, networkTypes []Networ
if tcpConn, ok := conn.LocalAddr().(*net.TCPAddr); ok {
conns = append(conns, connAndPort{conn, tcpConn.Port})
} else {
a.log.Warnf("failed to get port of connection from TCPMux: %s %s %s", network, ip, a.localUfrag)
a.log.Warnf("Failed to get port of connection from TCPMux: %s %s %s", network, ip, a.localUfrag)
}
}
if len(conns) == 0 {
@@ -213,7 +213,7 @@ func (a *Agent) gatherCandidatesLocal(ctx context.Context, networkTypes []Networ
if udpConn, ok := conn.LocalAddr().(*net.UDPAddr); ok {
conns = append(conns, connAndPort{conn, udpConn.Port})
} else {
a.log.Warnf("failed to get port of UDPAddr from ListenUDPInPortRange: %s %s %s", network, ip, a.localUfrag)
a.log.Warnf("Failed to get port of UDPAddr from ListenUDPInPortRange: %s %s %s", network, ip, a.localUfrag)
continue
}
}
@@ -399,7 +399,7 @@ func (a *Agent) gatherCandidatesSrflxUDPMux(ctx context.Context, urls []*URL, ne
hostPort := fmt.Sprintf("%s:%d", url.Host, url.Port)
serverAddr, err := a.net.ResolveUDPAddr(network, hostPort)
if err != nil {
a.log.Warnf("failed to resolve STUN host: %s: %v", hostPort, err)
a.log.Warnf("Failed to resolve STUN host: %s: %v", hostPort, err)
return
}
@@ -461,7 +461,7 @@ func (a *Agent) gatherCandidatesSrflx(ctx context.Context, urls []*URL, networkT
hostPort := fmt.Sprintf("%s:%d", url.Host, url.Port)
serverAddr, err := a.net.ResolveUDPAddr(network, hostPort)
if err != nil {
a.log.Warnf("failed to resolve STUN host: %s: %v", hostPort, err)
a.log.Warnf("Failed to resolve STUN host: %s: %v", hostPort, err)
return
}
+4 -4
View File
@@ -226,9 +226,9 @@ func TestVNetGatherWithNAT1To1(t *testing.T) {
err = a.GatherCandidates()
assert.NoError(t, err, "should succeed")
log.Debug("wait for gathering is done...")
log.Debug("Wait until gathering is complete...")
<-done
log.Debug("gathering is done")
log.Debug("Gathering is done")
candidates, err := a.GetLocalCandidates()
assert.NoError(t, err, "should succeed")
@@ -326,9 +326,9 @@ func TestVNetGatherWithNAT1To1(t *testing.T) {
err = a.GatherCandidates()
assert.NoError(t, err, "should succeed")
log.Debug("wait for gathering is done...")
log.Debug("Wait until gathering is complete...")
<-done
log.Debug("gathering is done")
log.Debug("Gathering is done")
candidates, err := a.GetLocalCandidates()
assert.NoError(t, err, "should succeed")
+1 -1
View File
@@ -124,7 +124,7 @@ func listenUDPInPortRange(n transport.Net, log logging.LeveledLogger, portMax, p
if e == nil {
return c, e //nolint:nilerr
}
log.Debugf("failed to listen %s: %v", lAddr.String(), e)
log.Debugf("Failed to listen %s: %v", lAddr.String(), e)
portCurrent++
if portCurrent > j {
portCurrent = i
+5 -5
View File
@@ -43,7 +43,7 @@ func (s *controllingSelector) isNominatable(c Candidate) bool {
return time.Since(s.startTime).Nanoseconds() > s.agent.relayAcceptanceMinWait.Nanoseconds()
}
s.log.Errorf("isNominatable invalid candidate type %s", c.Type().String())
s.log.Errorf("Invalid candidate type: %s", c.Type())
return false
}
@@ -117,7 +117,7 @@ func (s *controllingSelector) HandleBindingRequest(m *stun.Message, local, remot
func (s *controllingSelector) HandleSuccessResponse(m *stun.Message, local, remote Candidate, remoteAddr net.Addr) {
ok, pendingRequest := s.agent.handleInboundBindingSuccess(m.TransactionID)
if !ok {
s.log.Warnf("discard message from (%s), unknown TransactionID 0x%x", remote, m.TransactionID)
s.log.Warnf("Discard message from (%s), unknown TransactionID 0x%x", remote, m.TransactionID)
return
}
@@ -126,7 +126,7 @@ func (s *controllingSelector) HandleSuccessResponse(m *stun.Message, local, remo
// Assert that NAT is not symmetric
// https://tools.ietf.org/html/rfc8445#section-7.2.5.2.1
if !addrEqual(transactionAddr, remoteAddr) {
s.log.Debugf("discard message: transaction source and destination does not match expected(%s), actual(%s)", transactionAddr, remote)
s.log.Debugf("Discard message: transaction source and destination does not match expected(%s), actual(%s)", transactionAddr, remote)
return
}
@@ -208,7 +208,7 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
ok, pendingRequest := s.agent.handleInboundBindingSuccess(m.TransactionID)
if !ok {
s.log.Warnf("discard message from (%s), unknown TransactionID 0x%x", remote, m.TransactionID)
s.log.Warnf("Discard message from (%s), unknown TransactionID 0x%x", remote, m.TransactionID)
return
}
@@ -217,7 +217,7 @@ func (s *controlledSelector) HandleSuccessResponse(m *stun.Message, local, remot
// Assert that NAT is not symmetric
// https://tools.ietf.org/html/rfc8445#section-7.2.5.2.1
if !addrEqual(transactionAddr, remoteAddr) {
s.log.Debugf("discard message: transaction source and destination does not match expected(%s), actual(%s)", transactionAddr, remote)
s.log.Debugf("Discard message: transaction source and destination does not match expected(%s), actual(%s)", transactionAddr, remote)
return
}