audit message when server starts and shuts down

This commit is contained in:
2026-02-21 22:05:33 -07:00
parent 6189b474d0
commit 6e06c7a3a8
5 changed files with 46 additions and 0 deletions
+12
View File
@@ -11,6 +11,7 @@
package util
import (
"net"
"regexp"
"strings"
"time"
@@ -168,3 +169,14 @@ func Map[A, B any](in []A, fn func(A) B) []B {
}
return rc
}
// MyIPAddress returns the local IP address of this machine.
func MyIPAddress() (net.IP, error) {
conn, err := net.Dial("udp", "8.8.8.8:80")
if err != nil {
return nil, err
}
defer conn.Close()
localAddr := conn.LocalAddr().(*net.UDPAddr)
return localAddr.IP, nil
}