Maint: tun package to handle tun device operations
- Moved from openvpn package to tun package - TUN check verifies Rdev value - TUN create - Inject as interface to main function - Add integration test - Clearer log message for end users if tun device does not exist - Remove unix package (unneeded for tests) - Remove tun file opening at the end of tun file creation - Do not mock unix.Mkdev (no OS operation) - Remove Tun operations from OpenVPN configurator
This commit is contained in:
20
internal/tun/tun.go
Normal file
20
internal/tun/tun.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package tun
|
||||
|
||||
import "golang.org/x/sys/unix"
|
||||
|
||||
var _ Interface = (*Tun)(nil)
|
||||
|
||||
type Interface interface {
|
||||
Checker
|
||||
Creator
|
||||
}
|
||||
|
||||
type Tun struct {
|
||||
mknod func(path string, mode uint32, dev int) (err error)
|
||||
}
|
||||
|
||||
func New() *Tun {
|
||||
return &Tun{
|
||||
mknod: unix.Mknod,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user