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

This commit is contained in:
UUBulb authored and GitHub committed 2024-11-24 01:02:40 +08:00
1 parent ee37e35eb2
commit 88efe2d1d5
3 files changed
+5 -5

No files matched your search

+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)