Skip to content

Commit 2f7eab3

Browse files
committed
avoid confusion with IPv6 addresses in logging cfg.AllowFrom
1 parent 8e2d773 commit 2f7eab3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/socket-proxy/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os"
1313
"os/signal"
1414
"runtime"
15+
"strings"
1516
"syscall"
1617
"time"
1718

@@ -58,7 +59,9 @@ func main() {
5859
// print configuration
5960
slog.Info("starting socket-proxy", "version", version, "os", runtime.GOOS, "arch", runtime.GOARCH, "runtime", runtime.Version(), "URL", programURL)
6061
if cfg.ProxySocketEndpoint == "" {
61-
slog.Info("configuration info", "socketpath", cfg.SocketPath, "listenaddress", cfg.ListenAddress, "loglevel", cfg.LogLevel, "logjson", cfg.LogJSON, "allowfrom", cfg.AllowFrom, "shutdowngracetime", cfg.ShutdownGraceTime)
62+
// join the cfg.AllowFrom slice to a string to avoid the brackets in the logging (avoid confusion with IPv6 addresses)
63+
allowFromString := strings.Join(cfg.AllowFrom, ",")
64+
slog.Info("configuration info", "socketpath", cfg.SocketPath, "listenaddress", cfg.ListenAddress, "loglevel", cfg.LogLevel, "logjson", cfg.LogJSON, "allowfrom", allowFromString, "shutdowngracetime", cfg.ShutdownGraceTime)
6265
} else {
6366
slog.Info("configuration info", "socketpath", cfg.SocketPath, "proxysocketendpoint", cfg.ProxySocketEndpoint, "proxysocketendpointfilemode", cfg.ProxySocketEndpointFileMode, "loglevel", cfg.LogLevel, "logjson", cfg.LogJSON, "shutdowngracetime", cfg.ShutdownGraceTime)
6467
slog.Info("proxysocketendpoint is set, so the TCP listener is deactivated")

0 commit comments

Comments
 (0)