diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-03-13 17:55:05 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-03-13 17:55:53 +0100 |
commit | 0ad14a89f5f9da577dae6a63ad196015e51a0381 (patch) | |
tree | da74ec4dd4dd79b3577236bc30b42ea999e8516b /tun/tun_windows.go | |
parent | 7d327ed35aef08e2f54c12645a3002c94c6aec91 (diff) |
global: buff -> buf
This always struck me as kind of weird and non-standard.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'tun/tun_windows.go')
-rw-r--r-- | tun/tun_windows.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 320dd59..0cb4ce1 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -141,7 +141,7 @@ func (tun *NativeTun) BatchSize() int { // Note: Read() and Write() assume the caller comes only from a single thread; there's no locking. -func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error) { +func (tun *NativeTun) Read(bufs [][]byte, sizes []int, offset int) (int, error) { tun.running.Add(1) defer tun.running.Done() retry: @@ -158,7 +158,7 @@ retry: switch err { case nil: packetSize := len(packet) - copy(buffs[0][offset:], packet) + copy(bufs[0][offset:], packet) sizes[0] = packetSize tun.session.ReleaseReceivePacket(packet) tun.rate.update(uint64(packetSize)) @@ -179,22 +179,22 @@ retry: } } -func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) { +func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) { tun.running.Add(1) defer tun.running.Done() if tun.close.Load() { return 0, os.ErrClosed } - for i, buff := range buffs { - packetSize := len(buff) - offset + for i, buf := range bufs { + packetSize := len(buf) - offset tun.rate.update(uint64(packetSize)) packet, err := tun.session.AllocateSendPacket(packetSize) switch err { case nil: // TODO: Explore options to eliminate this copy. - copy(packet, buff[offset:]) + copy(packet, buf[offset:]) tun.session.SendPacket(packet) continue case windows.ERROR_HANDLE_EOF: @@ -205,7 +205,7 @@ func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) { return i, fmt.Errorf("Write failed: %w", err) } } - return len(buffs), nil + return len(bufs), nil } // LUID returns Windows interface instance ID. |