Skip to content

Commit

Permalink
update: improve fast test
Browse files Browse the repository at this point in the history
增加了提示的颜色,排版略作改动
  • Loading branch information
sjlleo committed Jun 15, 2022
1 parent e5fe66b commit 28c2961
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fast_trace/fast_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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()
}

Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 28c2961

Please sign in to comment.