MCPcopy Create free account
hub / github.com/V2RaySSR/RealityChecker / FormatSingleResult

Method FormatSingleResult

internal/report/formatter.go:24–43  ·  view source on GitHub ↗

FormatSingleResult 格式化单个检测结果

(result *types.DetectionResult)

Source from the content-addressed store, hash-verified

22
23// FormatSingleResult 格式化单个检测结果
24func (f *Formatter) FormatSingleResult(result *types.DetectionResult) string {
25 var output strings.Builder
26
27 // 使用表格格式化器,和批量检测保持一致的格式
28 tableFormatter := NewTableFormatter(f.config)
29
30 // 显示域名检测结果表格(无论适合与否)
31 output.WriteString("检测结果:\n\n")
32 output.WriteString(tableFormatter.FormatSuitableTable([]*types.DetectionResult{result}))
33 output.WriteString("\n")
34
35 // 如果不适合,显示不适合的原因
36 if !result.Suitable || result.Error != nil {
37 var unsuitableResults []*types.DetectionResult
38 unsuitableResults = append(unsuitableResults, result)
39 output.WriteString(tableFormatter.FormatUnsuitableSummary(unsuitableResults))
40 }
41
42 return output.String()
43}
44
45// FormatBatchResult 格式化批量检测结果
46func (f *Formatter) FormatBatchResult(results []*types.DetectionResult, totalDuration time.Duration) string {

Callers 1

executeCheckMethod · 0.95

Calls 3

FormatSuitableTableMethod · 0.95
NewTableFormatterFunction · 0.85

Tested by

no test coverage detected