chore: cleanup code formatting

This commit is contained in:
Christoph Haas
2025-02-28 08:29:40 +01:00
parent f7d7038829
commit e24acfa57d
67 changed files with 232 additions and 489 deletions

View File

@@ -9,8 +9,9 @@ import (
"strings"
"time"
"github.com/h44z/wg-portal/internal"
"github.com/sirupsen/logrus"
"github.com/h44z/wg-portal/internal"
)
const (
@@ -19,6 +20,8 @@ const (
InterfaceTypeAny InterfaceType = "any"
)
var allowedFileNameRegex = regexp.MustCompile("[^a-zA-Z0-9-_]+")
type InterfaceIdentifier string
type InterfaceType string
@@ -119,10 +122,8 @@ func (i *Interface) CopyCalculatedAttributes(src *Interface) {
}
func (i *Interface) GetConfigFileName() string {
reg := regexp.MustCompile("[^a-zA-Z0-9-_]+")
filename := internal.TruncateString(string(i.Identifier), 8)
filename = reg.ReplaceAllString(filename, "")
filename = allowedFileNameRegex.ReplaceAllString(filename, "")
filename += ".conf"
return filename