chore(tun): not linux or not darwin tagged files

This commit is contained in:
Quentin McGaw
2023-05-29 07:32:17 +00:00
parent caabaf918e
commit eca182a32f
6 changed files with 24 additions and 9 deletions

View File

@@ -1,3 +1,5 @@
//go:build linux || darwin
package tun
import (

View File

@@ -0,0 +1,7 @@
//go:build !linux && !darwin
package tun
func (t *Tun) Check(path string) error {
panic("not implemented")
}

View File

@@ -1,3 +1,5 @@
//go:build linux || darwin
package tun
import (
@@ -20,7 +22,7 @@ func (t *Tun) Create(path string) error {
minor = 200
)
dev := unix.Mkdev(major, minor)
err := t.mknod(path, unix.S_IFCHR, int(dev))
err := unix.Mknod(path, unix.S_IFCHR, int(dev))
if err != nil {
return fmt.Errorf("creating TUN device file node: %w", err)
}

View File

@@ -0,0 +1,8 @@
//go:build !linux && !darwin
package tun
// Create creates a TUN device at the path specified.
func (t *Tun) Create(path string) error {
panic("not implemented")
}

View File

@@ -1,13 +1,7 @@
package tun
import "golang.org/x/sys/unix"
type Tun struct {
mknod func(path string, mode uint32, dev int) (err error)
}
type Tun struct{}
func New() *Tun {
return &Tun{
mknod: unix.Mknod,
}
return &Tun{}
}

View File

@@ -1,3 +1,5 @@
//go:build linux || darwin
package tun
import (