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
Revert "Update network.go since To16 converts the IP address ip up to a 16-byte representation. If ip is not an IP address (it is the wrong length), To16 returns nil. (#5134)"
chrislubb9269f3f7ff
diff --git a/weed/util/network.go b/weed/util/network.goindex b7036377f7..69559b5f09 100644--- a/weed/util/network.go+++ b/weed/util/network.go@@ -15,13 +15,18 @@ func DetectedHostAddress() string {return ""}- if v4Address := selectIpV4(netInterfaces); v4Address != "" {+ if v4Address := selectIpV4(netInterfaces, true); v4Address != "" {return v4Address}+ if v6Address := selectIpV4(netInterfaces, false); v6Address != "" {+ return v6Address+ }+return "localhost"}-func selectIpV4(netInterfaces []net.Interface) string {++func selectIpV4(netInterfaces []net.Interface, isIpV4 bool) string {for _, netInterface := range netInterfaces {if (netInterface.Flags & net.FlagUp) == 0 {continue@@ -33,9 +38,15 @@ func selectIpV4(netInterfaces []net.Interface) string {for _, a := range addrs {if ipNet, ok := a.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {+ if isIpV4 {+ if ipNet.IP.To4() != nil {+ return ipNet.IP.String()+ }+ } else {if ipNet.IP.To16() != nil {return ipNet.IP.String()}+ }}}}