Skip to content

Commit 331e038

Browse files
committed
some: lint
1 parent b7c4599 commit 331e038

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

intra/dns53/mdns.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,14 +446,14 @@ func (c *client) send(q *dns.Msg) *dnsx.QueryError {
446446
} else {
447447
qname := xdns.QName(q)
448448
if c.unicast4 != nil {
449-
setDeadline(c.unicast4)
449+
extend(c.unicast4, timeout)
450450
if _, err = c.unicast4.WriteToUDP(buf, xdns.MDNSAddr4); err != nil {
451451
return dnsx.NewSendFailedQueryError(err)
452452
}
453453
log.D("mdns: send: sent query4 %s", qname)
454454
}
455455
if c.unicast6 != nil {
456-
setDeadline(c.unicast6)
456+
extend(c.unicast6, timeout)
457457
if _, err = c.unicast6.WriteToUDP(buf, xdns.MDNSAddr6); err != nil {
458458
return dnsx.NewSendFailedQueryError(err)
459459
}
@@ -479,7 +479,7 @@ func (c *client) recv(conn *net.UDPConn) {
479479

480480
raddr := conn.RemoteAddr()
481481
for c.closed.Load() == 0 {
482-
setDeadline(conn)
482+
extend(conn, timeout)
483483
n, err := conn.Read(buf)
484484

485485
if c.closed.Load() == 1 {
@@ -542,9 +542,8 @@ func (c *client) alias(src, dst string) {
542542
c.tracker[dst] = se
543543
}
544544

545-
func setDeadline(c *net.UDPConn) error {
545+
func extend(c net.Conn, t time.Duration) {
546546
if c != nil {
547-
return c.SetDeadline(time.Now().Add(timeout))
547+
_ = c.SetDeadline(time.Now().Add(t))
548548
}
549-
return errBindFail
550549
}

intra/doh/doh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,6 @@ func (t *transport) Status() int {
535535

536536
func clos(c io.Closer) {
537537
if c != nil {
538-
c.Close()
538+
_ = c.Close()
539539
}
540540
}

intra/ipn/wg/wgconn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,12 @@ func loge(err error, msg string, rest ...any) {
409409

410410
func extend(c net.Conn, t time.Duration) {
411411
if c != nil {
412-
c.SetDeadline(time.Now().Add(t))
412+
_ = c.SetDeadline(time.Now().Add(t))
413413
}
414414
}
415415

416416
func clos(c io.Closer) {
417417
if c != nil {
418-
c.Close()
418+
_ = c.Close()
419419
}
420420
}

0 commit comments

Comments
 (0)