mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 13:40:22 +03:00
Prevent minio server starting in standalone erasure mode for wrong inputs. (#4700)
It is possible at times due to a typo when distributed mode was intended a user might end up starting standalone erasure mode causing confusion. Add code to check this based on some standard heuristic guess work and report an error to the user. Fixes #4686
This commit is contained in:
committed by
Harshavardhana
parent
3544e5ad01
commit
1978b9d8f9
@@ -153,6 +153,15 @@ func getAPIEndpoints(serverAddr string) (apiEndpoints []string) {
|
||||
return apiEndpoints
|
||||
}
|
||||
|
||||
// isHostIPv4 - helper for validating if the provided arg is an ip address.
|
||||
func isHostIPv4(ipAddress string) bool {
|
||||
host, _, err := net.SplitHostPort(ipAddress)
|
||||
if err != nil {
|
||||
host = ipAddress
|
||||
}
|
||||
return net.ParseIP(host) != nil
|
||||
}
|
||||
|
||||
// checkPortAvailability - check if given port is already in use.
|
||||
// Note: The check method tries to listen on given port and closes it.
|
||||
// It is possible to have a disconnected client in this tiny window of time.
|
||||
|
||||
Reference in New Issue
Block a user