Better logging + runVM impl

This commit is contained in:
AlexSSD7 2023-08-25 16:54:58 +01:00
commit a63030fd00
7 changed files with 192 additions and 74 deletions

View file

@ -1,6 +1,7 @@
package utils
import (
"regexp"
"strings"
"unicode"
)
@ -13,3 +14,12 @@ func ClearUnprintableChars(s string) string {
return -1
}, s)
}
var devNameRegexp = regexp.MustCompile("^[0-9a-z_-]+$")
func ValidateDevName(s string) bool {
// Allow mapped devices.
s = strings.TrimPrefix(s, "mapper/")
return devNameRegexp.MatchString(s)
}