aboutsummaryrefslogtreecommitdiffstats
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2023-03-13 17:55:05 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2023-03-13 17:55:53 +0100
commit0ad14a89f5f9da577dae6a63ad196015e51a0381 (patch)
treeda74ec4dd4dd79b3577236bc30b42ea999e8516b /tun/tun_windows.go
parentconn: use right cmsghdr len types on 32-bit in sticky test (diff)
downloadwireguard-go-0ad14a89f5f9da577dae6a63ad196015e51a0381.tar.xz
wireguard-go-0ad14a89f5f9da577dae6a63ad196015e51a0381.zip
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 '')
-rw-r--r--tun/tun_windows.go14
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.