Fix lint errors

This commit is contained in:
Kevin Wang
2025-08-16 23:35:36 -04:00
parent e13ec52278
commit be0657f17b
3 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -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
View File
@@ -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
View File
@@ -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})
}