mirror of
https://github.com/h44z/wg-portal.git
synced 2025-09-15 07:11:15 +00:00
chore: cleanup code formatting
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user