audit message when server starts and shuts down
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user