mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Fix lint errors
This commit is contained in:
@@ -1094,9 +1094,9 @@ func (a *Agent) handleInbound(msg *stun.Message, local Candidate, remote net.Add
|
||||
}
|
||||
|
||||
if msg.Type.Method != stun.MethodBinding ||
|
||||
!(msg.Type.Class == stun.ClassSuccessResponse ||
|
||||
msg.Type.Class == stun.ClassRequest ||
|
||||
msg.Type.Class == stun.ClassIndication) {
|
||||
(msg.Type.Class != stun.ClassSuccessResponse &&
|
||||
msg.Type.Class != stun.ClassRequest &&
|
||||
msg.Type.Class != stun.ClassIndication) {
|
||||
a.log.Tracef("Unhandled STUN from %s to %s class(%s) method(%s)", remote, local, msg.Type.Class, msg.Type.Method)
|
||||
|
||||
return
|
||||
|
||||
+9
-9
@@ -243,7 +243,7 @@ func (c *candidateBase) recvLoop(initializedCh <-chan struct{}) {
|
||||
for {
|
||||
n, srcAddr, err := c.conn.ReadFrom(buf)
|
||||
if err != nil {
|
||||
if !(errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed)) {
|
||||
if !errors.Is(err, io.EOF) && !errors.Is(err, net.ErrClosed) {
|
||||
agent.log.Warnf("Failed to read from candidate %s: %v", c, err)
|
||||
}
|
||||
|
||||
@@ -891,10 +891,10 @@ func readCandidateCharToken(raw string, start int, limit int) (string, int, erro
|
||||
return "", 0, fmt.Errorf("token too long: %s expected 1x%d", raw[start:start+i], limit)
|
||||
}
|
||||
|
||||
if !(char >= 'A' && char <= 'Z' ||
|
||||
char >= 'a' && char <= 'z' ||
|
||||
char >= '0' && char <= '9' ||
|
||||
char == '+' || char == '/') {
|
||||
if (char < 'A' || char > 'Z') &&
|
||||
(char < 'a' || char > 'z') &&
|
||||
(char < '0' || char > '9') &&
|
||||
char != '+' && char != '/' {
|
||||
return "", 0, fmt.Errorf("invalid ice-char token: %c", char) //nolint: err113 // handled by caller
|
||||
}
|
||||
}
|
||||
@@ -928,7 +928,7 @@ func readCandidateDigitToken(raw string, start, limit int) (int, int, error) {
|
||||
return 0, 0, fmt.Errorf("token too long: %s expected 1x%d", raw[start:start+i], limit)
|
||||
}
|
||||
|
||||
if !(char >= '0' && char <= '9') {
|
||||
if char < '0' || char > '9' {
|
||||
return 0, 0, fmt.Errorf("invalid digit token: %c", char) //nolint: err113 // handled by caller
|
||||
}
|
||||
|
||||
@@ -962,9 +962,9 @@ func readCandidateByteString(raw string, start int) (string, int, error) {
|
||||
}
|
||||
|
||||
// 1*(%x01-09/%x0B-0C/%x0E-FF)
|
||||
if !(char >= 0x01 && char <= 0x09 ||
|
||||
char >= 0x0B && char <= 0x0C ||
|
||||
char >= 0x0E && char <= 0xFF) {
|
||||
if (char < 0x01 || char > 0x09) &&
|
||||
(char < 0x0B || char > 0x0C) &&
|
||||
(char < 0x0E || char > 0xFF) {
|
||||
return "", 0, fmt.Errorf("invalid byte-string character: %c", char) //nolint: err113 // handled by caller
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ func (t *tcpPacketConn) startReading(conn net.Conn) {
|
||||
t.params.Logger.Warnf("Failed to read streaming packet: %s", err)
|
||||
last := t.removeConn(conn)
|
||||
// Only propagate connection closure errors if no other open connection exists.
|
||||
if last || !(errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed)) {
|
||||
if last || (!errors.Is(err, io.EOF) && !errors.Is(err, net.ErrClosed)) {
|
||||
t.handleRecv(streamingPacket{nil, conn.RemoteAddr(), err})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user