|
|
@ -39,6 +39,7 @@ const ( |
|
|
|
healthPath = "/minio/health/live" |
|
|
|
healthPath = "/minio/health/live" |
|
|
|
timeout = time.Duration(30 * time.Second) |
|
|
|
timeout = time.Duration(30 * time.Second) |
|
|
|
tcp = "tcp" |
|
|
|
tcp = "tcp" |
|
|
|
|
|
|
|
anyIP = ":::" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// returns container boot time by finding
|
|
|
|
// returns container boot time by finding
|
|
|
@ -69,17 +70,15 @@ func findEndpoint() (string, error) { |
|
|
|
scanner := bufio.NewScanner(stdout) |
|
|
|
scanner := bufio.NewScanner(stdout) |
|
|
|
scanner.Split(bufio.ScanLines) |
|
|
|
scanner.Split(bufio.ScanLines) |
|
|
|
// MinIO works on TCP and it is supposed to be
|
|
|
|
// MinIO works on TCP and it is supposed to be
|
|
|
|
// the only process listening on a port inside
|
|
|
|
// the only process listening on a port on any IP address
|
|
|
|
// container. So we take the first row of netstat
|
|
|
|
// (on :::) inside container.
|
|
|
|
// output (that has tcp) and assume that is the
|
|
|
|
|
|
|
|
// MinIO server port.
|
|
|
|
|
|
|
|
// Since MinIO is running as non-root user, we can
|
|
|
|
// Since MinIO is running as non-root user, we can
|
|
|
|
// no longer depend on the PID/Program name column
|
|
|
|
// not depend on the PID/Program name column
|
|
|
|
// of netstat output
|
|
|
|
// of netstat output
|
|
|
|
for scanner.Scan() { |
|
|
|
for scanner.Scan() { |
|
|
|
if strings.Contains(scanner.Text(), tcp) { |
|
|
|
|
|
|
|
line := scanner.Text() |
|
|
|
line := scanner.Text() |
|
|
|
newLine := strings.Replace(line, ":::", "127.0.0.1:", 1) |
|
|
|
if strings.Contains(line, tcp) && strings.Contains(line, anyIP) { |
|
|
|
|
|
|
|
newLine := strings.Replace(line, anyIP, "127.0.0.1:", 1) |
|
|
|
fields := strings.Fields(newLine) |
|
|
|
fields := strings.Fields(newLine) |
|
|
|
// index 3 in the row has the Local address
|
|
|
|
// index 3 in the row has the Local address
|
|
|
|
// find the last index of ":" - address will
|
|
|
|
// find the last index of ":" - address will
|
|
|
|