Skip to content

Commit cbc511f

Browse files
committed
修改一些显示问题,对于FASTTRACE/TESTFILE功能应用NO_COLOR属性,对于TESTFILE应用IP隐匿功能。
修改: fast_trace/fast_trace.go
1 parent 66422c4 commit cbc511f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

fast_trace/fast_trace.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package fastTrace
33
import (
44
"bufio"
55
"fmt"
6+
"github.com/fatih/color"
67
"github.com/nxtrace/NTrace-core/ipgeo"
78
"github.com/nxtrace/NTrace-core/printer"
89
"github.com/nxtrace/NTrace-core/trace"
@@ -44,7 +45,10 @@ type IpListElement struct {
4445
var oe = false
4546

4647
func (f *FastTracer) tracert(location string, ispCollection ISPCollection) {
47-
fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX)
48+
//fmt.Printf("%s『%s %s 』%s\n", printer.YELLOW_PREFIX, location, ispCollection.ISPName, printer.RESET_PREFIX)
49+
fmt.Fprintf(color.Output, "%s\n",
50+
color.New(color.FgYellow, color.Bold).Sprint("『 "+location+ispCollection.ISPName+" 』"),
51+
)
4852
fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ispCollection.IP, f.ParamsFastTrace.MaxHops, f.ParamsFastTrace.PktSize)
4953

5054
ip, err := util.DomainLookUp(ispCollection.IP, "4", "", true)
@@ -274,8 +278,14 @@ func testFile(paramsFastTrace ParamsFastTrace, tm bool) {
274278
}
275279

276280
for _, ip := range ipList {
277-
fmt.Printf("%s『%s』%s\n", printer.YELLOW_PREFIX, ip.Desc, printer.RESET_PREFIX)
278-
fmt.Printf("traceroute to %s, %d hops max, %d byte packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize)
281+
fmt.Fprintf(color.Output, "%s\n",
282+
color.New(color.FgYellow, color.Bold).Sprint("『 "+ip.Desc+"』"),
283+
)
284+
if util.EnableHidDstIP == "" {
285+
fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", ip.Ip, paramsFastTrace.MaxHops, paramsFastTrace.PktSize)
286+
} else {
287+
fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", util.HideIPPart(ip.Ip), paramsFastTrace.MaxHops, paramsFastTrace.PktSize)
288+
}
279289
var srcAddr string
280290
if ip.Version4 {
281291
if paramsFastTrace.SrcDev != "" {

0 commit comments

Comments
 (0)