mirror of
https://github.com/fosrl/newt.git
synced 2026-02-07 21:46:39 +00:00
Remove native and add util
This commit is contained in:
16
util/util.go
16
util/util.go
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user