Make usage of WireGuard kernel configurable from env

This commit is contained in:
braginini
2023-04-05 16:30:52 +02:00
parent 367eff493a
commit 005c4dd44a

View File

@@ -33,6 +33,7 @@ const (
loading
live
inuse
envDisableWireGuardKernel = "NB_WG_KERNEL_DISABLED"
)
type module struct {
@@ -83,7 +84,12 @@ func tunModuleIsLoaded() bool {
// WireGuardModuleIsLoaded check if we can load WireGuard mod (linux only)
func WireGuardModuleIsLoaded() bool {
return false
if os.Getenv(envDisableWireGuardKernel) == "true" {
log.Infof("WireGuard kernel module disabled because the %s env is set to true", envDisableWireGuardKernel)
return false
}
if canCreateFakeWireGuardInterface() {
return true
}