mirror of
https://github.com/minio/minio.git
synced 2025-04-17 01:10:29 -04:00
feat: allow listening specific addrs for API port (#16223)
This commit is contained in:
parent
76905b7a67
commit
37e20f6ef2
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2015-2021 MinIO, Inc.
|
// Copyright (c) 2015-2022 MinIO, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of MinIO Object Storage stack
|
// This file is part of MinIO Object Storage stack
|
||||||
//
|
//
|
||||||
@ -466,8 +466,23 @@ func getServerListenAddrs() []string {
|
|||||||
addrs.Add(net.JoinHostPort(ip.String(), globalMinioPort))
|
addrs.Add(net.JoinHostPort(ip.String(), globalMinioPort))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add the interface specified by the user
|
host, _ := mustSplitHostPort(globalMinioAddr)
|
||||||
addrs.Add(globalMinioAddr)
|
if host != "" {
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
haddrs, err := globalDNSCache.LookupHost(ctx, host)
|
||||||
|
if err == nil {
|
||||||
|
for _, addr := range haddrs {
|
||||||
|
addrs.Add(net.JoinHostPort(addr, globalMinioPort))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Unable to lookup host in 2-secs, let it fail later anyways.
|
||||||
|
addrs.Add(globalMinioAddr)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
addrs.Add(globalMinioAddr)
|
||||||
|
}
|
||||||
return addrs.ToSlice()
|
return addrs.ToSlice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user