Skip to content

Commit

Permalink
Add in docstrings/package doc
Browse files Browse the repository at this point in the history
  • Loading branch information
paultag committed May 26, 2023
1 parent 7577442 commit cdfe3f2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
all: build test check

build:

test:
go test -v ./...

check-lint:
revive ./...

check: check-lint

clean:

.PHONY: build check test
2 changes: 2 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. }}}

// Package tap contains bindings to create TAP/TUN interfaces on Linux and
// OpenBSD.
package tap

// vim: foldmethod=marker
6 changes: 6 additions & 0 deletions tap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"golang.org/x/sys/unix"
)

// Interface is a handle to a created TAP/TUN interface.
type Interface struct {
name [syscall.IFNAMSIZ]byte
fd *os.File
Expand All @@ -37,15 +38,20 @@ type Interface struct {
ps platformState
}

// Name will return the UNIX interface name for the TAP/TUN interface.
func (i Interface) Name() string {
return unix.ByteSliceToString(i.name[:])
}

// Close will release all resources held by this Interface.
func (i Interface) Close() error {
i.cancel()
return nil
}

// Options contains a number of configuration params for the creation of
// the TAP/TUN interface. The PlatformOptions struct is OS dependent, and
// may contain options on your OS that are not present on other OSs.
type Options struct {
PlatformOptions PlatformOptions
}
Expand Down

0 comments on commit cdfe3f2

Please sign in to comment.