diff options
Diffstat (limited to 'tun/tun_darwin.go')
-rw-r--r-- | tun/tun_darwin.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tun/tun_darwin.go b/tun/tun_darwin.go index b927e6f..c9a6c0b 100644 --- a/tun/tun_darwin.go +++ b/tun/tun_darwin.go @@ -217,7 +217,7 @@ func (tun *NativeTun) Events() <-chan Event { return tun.events } -func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error) { +func (tun *NativeTun) Read(bufs [][]byte, sizes []int, offset int) (int, error) { // TODO: the BSDs look very similar in Read() and Write(). They should be // collapsed, with platform-specific files containing the varying parts of // their implementations. @@ -225,8 +225,8 @@ func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error) case err := <-tun.errors: return 0, err default: - buff := buffs[0][offset-4:] - n, err := tun.tunFile.Read(buff[:]) + buf := bufs[0][offset-4:] + n, err := tun.tunFile.Read(buf[:]) if n < 4 { return 0, err } @@ -235,11 +235,11 @@ func (tun *NativeTun) Read(buffs [][]byte, sizes []int, offset int) (int, error) } } -func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) { +func (tun *NativeTun) Write(bufs [][]byte, offset int) (int, error) { if offset < 4 { return 0, io.ErrShortBuffer } - for i, buf := range buffs { + for i, buf := range bufs { buf = buf[offset-4:] buf[0] = 0x00 buf[1] = 0x00 @@ -256,7 +256,7 @@ func (tun *NativeTun) Write(buffs [][]byte, offset int) (int, error) { return i, err } } - return len(buffs), nil + return len(bufs), nil } func (tun *NativeTun) Close() error { |