package server import ( "fmt" "net" ) // GetLANIPs returns all non-loopback IPv4 addresses. func GetLANIPs() ([]string, error) { addrs, err := net.InterfaceAddrs() if err != nil { return nil, err } var ips []string for _, addr := range addrs { if ipNet, ok := addr.(*net.IPNet); ok && !ipNet.IP.IsLoopback() && ipNet.IP.To4() != nil { ips = append(ips, ipNet.IP.String()) } } if len(ips) == 0 { return nil, fmt.Errorf("no LAN IP found") } return ips, nil }