chore(tun): not linux or not darwin tagged files
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//go:build linux || darwin
|
||||
|
||||
package tun
|
||||
|
||||
import (
|
||||
|
||||
7
internal/tun/check_unspecified.go
Normal file
7
internal/tun/check_unspecified.go
Normal file
@@ -0,0 +1,7 @@
|
||||
//go:build !linux && !darwin
|
||||
|
||||
package tun
|
||||
|
||||
func (t *Tun) Check(path string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
8
internal/tun/create_unspecified.go
Normal file
8
internal/tun/create_unspecified.go
Normal 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")
|
||||
}
|
||||
@@ -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{}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build linux || darwin
|
||||
|
||||
package tun
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user