From 28c29614902496b8063f73f917b67d219be808f4 Mon Sep 17 00:00:00 2001 From: sjlleo Date: Wed, 15 Jun 2022 14:29:03 +0800 Subject: [PATCH] update: improve fast test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加了提示的颜色,排版略作改动 --- fast_trace/fast_trace.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fast_trace/fast_trace.go b/fast_trace/fast_trace.go index a04f03f..e086e0b 100644 --- a/fast_trace/fast_trace.go +++ b/fast_trace/fast_trace.go @@ -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) }