(evt *event.CommandStartedEvent)
| 85 | } |
| 86 | |
| 87 | func peerInfo(evt *event.CommandStartedEvent) (hostname string, port uint16) { |
| 88 | hostname = evt.ConnectionID |
| 89 | strPort := "27017" |
| 90 | if idx := strings.IndexByte(hostname, '['); idx >= 0 { |
| 91 | hostname = hostname[:idx] |
| 92 | } |
| 93 | if idx := strings.IndexByte(hostname, ':'); idx >= 0 { |
| 94 | strPort = hostname[idx+1:] |
| 95 | hostname = hostname[:idx] |
| 96 | } |
| 97 | uintPort, _ := strconv.ParseUint(strPort, 10, 32) |
| 98 | return hostname, uint16(uintPort) |
| 99 | } |