MCPcopy Create free account
hub / github.com/MengMengCode/GetRealityDomain / showResultsPaginated

Function showResultsPaginated

main.go:334–409  ·  view source on GitHub ↗

分页显示结果

(filename string)

Source from the content-addressed store, hash-verified

332
333// 分页显示结果
334func showResultsPaginated(filename string) {
335 // 读取符合条件的结果
336 feasibleResults, err := loadFeasibleResults(filename)
337 if err != nil {
338 printError(fmt.Sprintf("加载结果失败: %v", err))
339 return
340 }
341
342 if len(feasibleResults) == 0 {
343 printInfo("没有找到符合条件的目标")
344 return
345 }
346
347 pageSize := 10
348 totalPages := (len(feasibleResults) + pageSize - 1) / pageSize
349 currentPage := 1
350
351 for {
352 clearScreen()
353 printBox([]string{
354 "",
355 fmt.Sprintf(" ═══ Reality目标列表 (第%d/%d页) ═══", currentPage, totalPages),
356 "",
357 fmt.Sprintf(" 总共找到 %d 个符合条件的目标", len(feasibleResults)),
358 "",
359 })
360
361 // 显示当前页的结果
362 start := (currentPage - 1) * pageSize
363 end := start + pageSize
364 if end > len(feasibleResults) {
365 end = len(feasibleResults)
366 }
367
368 fmt.Printf("%-4s %-15s %-40s %-15s\n",
369 "序号", "IP地址", "证书域名", "响应时间(ms)")
370 fmt.Println(strings.Repeat("-", 75))
371
372 for i := start; i < end; i++ {
373 result := feasibleResults[i]
374 fmt.Printf("%-4d %-15s %-40s %-15s\n",
375 i+1,
376 result[0], // IP
377 result[3], // CERT_DOMAIN (完整显示)
378 result[10], // RESPONSE_TIME_MS
379 )
380 }
381
382 fmt.Println("\n操作选项:")
383 if currentPage > 1 {
384 fmt.Print(" [P] 上一页 ")
385 }
386 if currentPage < totalPages {
387 fmt.Print(" [N] 下一页 ")
388 }
389 fmt.Print(" [Q] 返回")
390 fmt.Print("\n请选择: ")
391

Callers 1

mainFunction · 0.85

Calls 7

loadFeasibleResultsFunction · 0.85
printErrorFunction · 0.85
printInfoFunction · 0.85
clearScreenFunction · 0.85
printBoxFunction · 0.85
getStringInputFunction · 0.85
pauseFunction · 0.85

Tested by

no test coverage detected