diff --git a/fast_trace/fast_trace.go b/fast_trace/fast_trace.go index 31d18c6..f1558a1 100644 --- a/fast_trace/fast_trace.go +++ b/fast_trace/fast_trace.go @@ -3,6 +3,7 @@ package fastTrace import ( "bufio" "fmt" + "github.com/fatih/color" "github.com/nxtrace/NTrace-core/ipgeo" "github.com/nxtrace/NTrace-core/printer" "github.com/nxtrace/NTrace-core/trace" @@ -44,7 +45,10 @@ type IpListElement struct { var oe = false func (f *FastTracer) tracert(location string, ispCollection ISPCollection) { - fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX) + //fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX) + fmt.Fprintf(color.Output, "%s\n", + color.New(color.FgYellow, color.Bold).Sprint("『 "+location+ispCollection.ISPName+" 』"), + ) fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IP, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize) ip, err := util.DomainLookUp(ispCollection.IP, "4", "", true) @@ -274,8 +278,14 @@ func testFile(paramsFastTrace ParamsFastTrace, tm bool) { } for _, ip := range ipList { - fmt.Printf("%s『%s』%s\n", printer.YELLOW_PREFIX, ip.Desc, printer.RESET_PREFIX) - fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + fmt.Fprintf(color.Output, "%s\n", + color.New(color.FgYellow, color.Bold).Sprint("『 "+ip.Desc+"』"), + ) + if util.EnableHidDstIP == "" { + fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + } else { + fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", util.HideIPPart(ip.Ip), paramsFastTrace.MaxHops, paramsFastTrace.PktSize) + } var srcAddr string if ip.Version4 { if paramsFastTrace.SrcDev != "" {