device.go 820 B

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