custon dashboard template [no ci]

This commit is contained in:
naiba
2022-06-03 09:45:11 +08:00
parent eb0501ad97
commit 2ab7a5fdd8
20 changed files with 95 additions and 37 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"crypto/md5" // #nosec
"encoding/hex"
"io"
"math/rand"
"os"
"regexp"
@@ -93,3 +94,17 @@ func SplitIPAddr(v4v6Bundle string) (string, string, string) {
}
return ipv4, ipv6, validIP
}
func IsDirEmpty(name string) (bool, error) {
f, err := os.Open(name)
if err != nil {
return false, err
}
defer f.Close()
_, err = f.Readdirnames(1)
if err == io.EOF {
return true, nil
}
return false, err
}