SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
better detect IP address
Chris Lu021358749bbc
diff --git a/weed/util/network.go b/weed/util/network.goindex 7108cfea6d..55a123667c 100644--- a/weed/util/network.go+++ b/weed/util/network.go@@ -7,16 +7,26 @@ import ()func DetectedHostAddress() string {- addrs, err := net.InterfaceAddrs()+ netInterfaces, err := net.Interfaces()if err != nil {- glog.V(0).Infof("failed to detect ip address: %v", err)+ glog.V(0).Infof("failed to detect net interfaces: %v", err)return ""}- for _, a := range addrs {- if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {- if ipnet.IP.To4() != nil {- return ipnet.IP.String()+ for _, netInterface := range netInterfaces {+ if (netInterface.Flags & net.FlagUp) == 0 {+ continue+ }+ addrs, err := netInterface.Addrs()+ if err != nil {+ glog.V(0).Infof("get interface addresses: %v", err)+ }++ for _, a := range addrs {+ if ipNet, ok := a.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {+ if ipNet.IP.To4() != nil {+ return ipNet.IP.String()+ }}}}