diff --git a/README.md b/README.md index 079fbee..ff8c36c 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,12 @@ nexttrace --tcp --port 443 2001:4860:4860::8888 # UDP Trace nexttrace --udp 1.0.0.1 -nexttrace --udp --port 53 1.0.0.1 +# You can specify the target port yourself [here it is 5353], the default is port 33494 +nexttrace --udp --port 5353 1.0.0.1 + +# For TCP/UDP Trace, you can specify the source port; by default, a fixed random port is used +# (if you need to use a different random source port for each packet, please set the ENV variable NEXTTRACE_RANDOMPORT) +nexttrace --tcp --source-port 14514 www.bing.com ``` `NextTrace` also supports some advanced functions, such as ttl control, concurrent probe packet count control, mode switching, etc. @@ -383,6 +388,8 @@ Arguments: -e --disable-mpls Disable MPLS -v --version Print version info and exit -s --source Use source src_addr for outgoing packets + --source-port Use source port src_port for outgoing + packets -D --dev Use the following Network Devices as the source address in outgoing packets -z --send-time Set how many [milliseconds] between diff --git a/README_zh_CN.md b/README_zh_CN.md index 8aa5d00..9947146 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -226,14 +226,17 @@ nexttrace --source 204.98.134.56 9.9.9.9 # TCP SYN Trace nexttrace --tcp www.bing.com -# 可以自行指定端口[此处为443],默认80端口 +# 可以自行指定目标端口[此处为443],默认80端口 nexttrace --tcp --port 443 2001:4860:4860::8888 # UDP Trace nexttrace --udp 1.0.0.1 -# 可以自行指定端口[此处为5353],默认33494端口 +# 可以自行指定目标端口[此处为5353],默认33494端口 nexttrace --udp --port 5353 1.0.0.1 + +# TCP/UDP Trace 可以自行指定源端口,默认使用随机一个固定的端口(如需每次发包随机使用不同的源端口,请设置`ENV` `NEXTTRACE_RANDOMPORT`) +nexttrace --tcp --source-port 14514 www.bing.com ``` `NextTrace`也同样支持一些进阶功能,如 TTL 控制、并发数控制、模式切换等 @@ -377,6 +380,8 @@ Arguments: -e --disable-mpls Disable MPLS -v --version Print version info and exit -s --source Use source src_addr for outgoing packets + --source-port Use source port src_port for outgoing + packets -D --dev Use the following Network Devices as the source address in outgoing packets -z --send-time Set how many [milliseconds] between diff --git a/cmd/cmd.go b/cmd/cmd.go index 7e63c82..0012f1c 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -58,7 +58,7 @@ func Excute() { disableMPLS := parser.Flag("e", "disable-mpls", &argparse.Options{Help: "Disable MPLS"}) ver := parser.Flag("v", "version", &argparse.Options{Help: "Print version info and exit"}) srcAddr := parser.String("s", "source", &argparse.Options{Help: "Use source address src_addr for outgoing packets"}) - srcPort := parser.Int("", "source-port", &argparse.Options{Help: "Use source port src_port for outgoing packets (TCP and UDP only)"}) + srcPort := parser.Int("", "source-port", &argparse.Options{Help: "Use source port src_port for outgoing packets"}) srcDev := parser.String("D", "dev", &argparse.Options{Help: "Use the following Network Devices as the source address in outgoing packets"}) //router := parser.Flag("R", "route", &argparse.Options{Help: "Show Routing Table [Provided By BGP.Tools]"}) packetInterval := parser.Int("z", "send-time", &argparse.Options{Default: 50, Help: "Set how many [milliseconds] between sending each packet. Useful when some routers use rate-limit for ICMP messages"})