improve: use IndexByte to find the colon of ip address (#92)

This commit is contained in:
UUBulb
2024-11-24 01:02:40 +08:00
committed by GitHub
parent ee37e35eb2
commit 88efe2d1d5
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -575,7 +575,7 @@ func handleTcpPingTask(task *pb.Task, result *pb.TaskResult) {
result.Data = err.Error()
return
}
if strings.Contains(ipAddr, ":") {
if strings.IndexByte(ipAddr, ':') != -1 {
ipAddr = fmt.Sprintf("[%s]", ipAddr)
}
printf("TCP-Ping Task: Pinging %s:%s", ipAddr, port)