chore(tun): not linux or not darwin tagged files
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
//go:build linux || darwin
|
||||||
|
|
||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
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
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -20,7 +22,7 @@ func (t *Tun) Create(path string) error {
|
|||||||
minor = 200
|
minor = 200
|
||||||
)
|
)
|
||||||
dev := unix.Mkdev(major, minor)
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("creating TUN device file node: %w", err)
|
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
|
package tun
|
||||||
|
|
||||||
import "golang.org/x/sys/unix"
|
type Tun struct{}
|
||||||
|
|
||||||
type Tun struct {
|
|
||||||
mknod func(path string, mode uint32, dev int) (err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
func New() *Tun {
|
func New() *Tun {
|
||||||
return &Tun{
|
return &Tun{}
|
||||||
mknod: unix.Mknod,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//go:build linux || darwin
|
||||||
|
|
||||||
package tun
|
package tun
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
Reference in New Issue
Block a user