Remove native and add util

This commit is contained in:
Owen
2025-11-17 15:32:22 -05:00
parent 9caa9fa31e
commit 46b33fdca6
5 changed files with 22 additions and 96 deletions

View File

@@ -10,6 +10,7 @@ import (
mathrand "math/rand/v2"
"github.com/fosrl/newt/logger"
"golang.zx2c4.com/wireguard/device"
)
func ResolveDomain(domain string) (string, error) {
@@ -136,3 +137,18 @@ func FixKey(key string) string {
// Convert to hex
return hex.EncodeToString(decoded)
}
func MapToWireGuardLogLevel(level logger.LogLevel) int {
switch level {
case logger.DEBUG:
return device.LogLevelVerbose
// case logger.INFO:
// return device.LogLevel
case logger.WARN:
return device.LogLevelError
case logger.ERROR, logger.FATAL:
return device.LogLevelSilent
default:
return device.LogLevelSilent
}
}