cleanups to startup code and goroutine code

This commit is contained in:
2026-05-06 22:19:08 -06:00
parent 08a10a55dd
commit a2c2a1f750
9 changed files with 92 additions and 88 deletions
-12
View File
@@ -13,7 +13,6 @@
package util
import (
"net"
"regexp"
"strings"
"time"
@@ -172,17 +171,6 @@ 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
}
// IIF is an "immediate-if" function returning its second argument if the first one is true, the third one if not.
func IIF[A any](expr bool, v1, v2 A) A {
if expr {