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:
@@ -4,7 +4,6 @@ package openvpn
|
||||
|
||||
import (
|
||||
"github.com/qdm12/gluetun/internal/constants"
|
||||
"github.com/qdm12/gluetun/internal/unix"
|
||||
"github.com/qdm12/golibs/command"
|
||||
"github.com/qdm12/golibs/logging"
|
||||
)
|
||||
@@ -12,7 +11,6 @@ import (
|
||||
type Configurator interface {
|
||||
VersionGetter
|
||||
AuthWriter
|
||||
TUNCheckCreater
|
||||
Starter
|
||||
}
|
||||
|
||||
@@ -24,18 +22,14 @@ type StarterAuthWriter interface {
|
||||
type configurator struct {
|
||||
logger logging.Logger
|
||||
cmder command.RunStarter
|
||||
unix unix.Unix
|
||||
authFilePath string
|
||||
tunDevPath string
|
||||
}
|
||||
|
||||
func NewConfigurator(logger logging.Logger, unix unix.Unix,
|
||||
func NewConfigurator(logger logging.Logger,
|
||||
cmder command.RunStarter) Configurator {
|
||||
return &configurator{
|
||||
logger: logger,
|
||||
cmder: cmder,
|
||||
unix: unix,
|
||||
authFilePath: constants.OpenVPNAuthConf,
|
||||
tunDevPath: constants.TunnelDevice,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user