github.com/slackhq/nebula@v1.9.0/wintun/device.go (about)

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