Fix lint errors

This commit is contained in:
世界 2026-06-22 15:49:11 +08:00
parent a9f4123ba2
commit 46aa536b37
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
41 changed files with 498 additions and 406 deletions

View file

@ -132,7 +132,7 @@ func New(options Options) (Tun, error) {
stopFd: common.Must1(stopfd.New()),
sendMsgX: options.EXP_SendMsgX,
}
for i := 0; i < batchSize; i++ {
for i := range batchSize {
nativeTun.iovecs[i] = newIovecBuffer(int(options.MTU))
nativeTun.iovecsOutput[i] = newIovecBuffer(int(options.MTU))
}
@ -352,7 +352,7 @@ func (t *NativeTun) BatchRead() ([]*buf.Buffer, error) {
}
n, errno := rawfile.BlockingRecvMMsgUntilStopped(t.stopFd.ReadFD, t.tunFd, t.msgHdrs)
if errno != 0 {
for k := 0; k < n; k++ {
for k := range n {
t.iovecs[k].buffer.Release()
t.iovecs[k].buffer = nil
}
@ -366,7 +366,7 @@ func (t *NativeTun) BatchRead() ([]*buf.Buffer, error) {
return nil, nil
}
buffers := t.buffers
for k := 0; k < n; k++ {
for k := range n {
buffer := t.iovecs[k].buffer
t.iovecs[k].buffer = nil
buffer.Truncate(int(t.msgHdrs[k].DataLen) - PacketOffset)