feat: send gateway dns and private address (#3378)

This commit is contained in:
Aceix
2025-03-18 09:26:29 +00:00
committed by GitHub
parent 3d765f9cf1
commit 39d812f137
3 changed files with 25 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package utils
import (
"log/slog"
"runtime"
"strings"
"time"
)
@@ -59,3 +60,18 @@ func TraceCaller() {
slog.Debug("Called from function: %s\n", "func-name", funcName)
slog.Debug("File: %s, Line: %d\n", "file", file, "line-no", line)
}
// NoEmptyStringToCsv takes a bunch of strings, filters out empty ones and returns a csv version of the string
func NoEmptyStringToCsv(strs ...string) string {
var sb strings.Builder
for _, str := range strs {
trimmedStr := strings.TrimSpace(str)
if trimmedStr != "" && trimmedStr != "<nil>" {
if sb.Len() > 0 {
sb.WriteString(", ")
}
sb.WriteString(str)
}
}
return sb.String()
}