device.go 838 B

123456789101112131415161718192021222324
  1. //go:build windows
  2. // +build windows
  3. /* SPDX-License-Identifier: MIT
  4. *
  5. * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
  6. */
  7. //NOTE: this file was forked from https://git.zx2c4.com/wireguard-go/tree/tun/tun.go?id=851efb1bb65555e0f765a3361c8eb5ac47435b19
  8. package wintun
  9. import (
  10. "os"
  11. )
  12. type Device interface {
  13. File() *os.File // returns the file descriptor of the device
  14. Read([]byte, int) (int, error) // read a packet from the device (without any additional headers)
  15. Write([]byte, int) (int, error) // writes a packet to the device (without any additional headers)
  16. Flush() error // flush all previous writes to the device
  17. Name() (string, error) // fetches and returns the current name
  18. Close() error // stops the device and closes the event channel
  19. }