feat: 添加测试模式,方便开发调试

This commit is contained in:
spiritlhl committed 2025-04-06 12:51:53 +00:00
1 parent 1a985cfbbe
commit c9c62e86f3
3 files changed
+31 -30

No files matched your search

+3 -2
View File
@@ -25,12 +25,13 @@ func main() {
http.Get("https://hits.spiritlhl.net/backtrace.svg?action=hit&title=Hits&title_bg=%23555555&count_bg=%230eecf8&edge_flat=false")
}()
fmt.Println(Green("项目地址:"), Yellow("https://github.com/oneclickvirt/backtrace"))
var showVersion, showIpInfo, help bool
var showVersion, showIpInfo, help, test bool
backtraceFlag := flag.NewFlagSet("backtrace", flag.ContinueOnError)
backtraceFlag.BoolVar(&help, "h", false, "Show help information")
backtraceFlag.BoolVar(&showVersion, "v", false, "Show version")
backtraceFlag.BoolVar(&showIpInfo, "s", true, "Disabe show ip info")
backtraceFlag.BoolVar(&backtrace.EnableLoger, "e", false, "Enable logging")
backtraceFlag.BoolVar(&test, "test", false, "Test Mode")
backtraceFlag.Parse(os.Args[1:])
if help {
fmt.Printf("Usage: %s [options]\n", os.Args[0])
@@ -56,7 +57,7 @@ func main() {
}
}
}
backtrace.BackTrace()
backtrace.BackTrace(test)
fmt.Println(Yellow("准确线路自行查看详细路由,本测试结果仅作参考"))
fmt.Println(Yellow("同一目标地址多个线路时,可能检测已越过汇聚层,除了第一个线路外,后续信息可能无效"))
if runtime.GOOS == "windows" || runtime.GOOS == "darwin" {