update: improve fast test

增加了提示的颜色,排版略作改动
This commit is contained in:
sjlleo
2022-06-15 14:29:03 +08:00
parent e5fe66b9ab
commit baebe16104

View File

@@ -16,7 +16,7 @@ type FastTracer struct {
}
func (f *FastTracer) tracert(location string, ispCollection ISPCollection) {
fmt.Printf("『%s %s 』\n", location, ispCollection.ISPName)
fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX)
fmt.Printf("traceroute to %s, 30 hops max, 32 byte packets\n", ispCollection.IP)
ip := net.ParseIP(ispCollection.IP)
var conf = trace.Config{
@@ -43,13 +43,19 @@ func (f *FastTracer) tracert(location string, ispCollection ISPCollection) {
if f.TracerouteMethod == trace.TCPTrace {
printer.TracerouteTablePrinter(res)
// 单次测试结束阻塞 3 秒,仅阻塞 TCP
<-time.After(time.Second * 3)
}
println()
}
func (f *FastTracer) testAll() {
f.testCT()
println()
f.testCU()
println()
f.testCM()
println()
f.testEDU()
}
@@ -80,7 +86,6 @@ func (f *FastTracer) testEDU() {
f.tracert(TestIPsCollection.Beijing.Location, TestIPsCollection.Beijing.EDU)
f.tracert(TestIPsCollection.Shanghai.Location, TestIPsCollection.Shanghai.EDU)
f.tracert(TestIPsCollection.Hangzhou.Location, TestIPsCollection.Hangzhou.EDU)
f.tracert(TestIPsCollection.Hefei.Location, TestIPsCollection.Hefei.EDU)
// 科技网暂时算在EDU里面等拿到了足够多的数据再分离出去单独用于测试
f.tracert(TestIPsCollection.Hefei.Location, TestIPsCollection.Hefei.CST)
}