mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2025-08-12 06:26:39 +00:00
修正之前对于payload size设置的错误表述
This commit is contained in:
25
README.md
25
README.md
@@ -329,16 +329,10 @@ Arguments:
|
||||
-T --tcp Use TCP SYN for tracerouting (default port
|
||||
is 80)
|
||||
-U --udp Use UDP SYN for tracerouting (default port
|
||||
is 53)
|
||||
is 33494)
|
||||
-F --fast-trace One-Key Fast Trace to China ISPs
|
||||
-p --port Set the destination port to use. It is
|
||||
either initial udp port value for
|
||||
"default"method (incremented by each
|
||||
probe, default is 33434), or initial seq
|
||||
for "icmp" (incremented as well, default
|
||||
from 1), or some constantdestination port
|
||||
for other methods (with default of 80 for
|
||||
"tcp", 53 for "udp", etc.)
|
||||
-p --port Set the destination port to use. With
|
||||
default of 80 for "tcp", 33494 for "udp"
|
||||
-q --queries Set the number of probes per each hop.
|
||||
Default: 3
|
||||
--parallel-requests Set ParallelRequests number. It should be
|
||||
@@ -350,9 +344,9 @@ Arguments:
|
||||
IPInfo, IPInsight, IP-API.com, Ip2region,
|
||||
IPInfoLocal, CHUNZHEN, disable-geoip].
|
||||
Default: LeoMoeAPI
|
||||
--pow-provider Choose PoW Provider [api.nxtrace.org, sakura]
|
||||
For China mainland users, please use
|
||||
sakura. Default: api.nxtrace.org
|
||||
--pow-provider Choose PoW Provider [api.nxtrace.org,
|
||||
sakura] For China mainland users, please
|
||||
use sakura. Default: api.nxtrace.org
|
||||
-n --no-rdns Do not resolve IP addresses to their
|
||||
domain names
|
||||
-a --always-rdns Always resolve IP addresses to their
|
||||
@@ -379,16 +373,15 @@ Arguments:
|
||||
-z --send-time Set how many [milliseconds] between
|
||||
sending each packet.. Useful when some
|
||||
routers use rate-limit for ICMP messages.
|
||||
Default: 100
|
||||
Default: 50
|
||||
-i --ttl-time Set how many [milliseconds] between
|
||||
sending packets groups by TTL. Useful when
|
||||
some routers use rate-limit for ICMP
|
||||
messages. Default: 500
|
||||
messages. Default: 50
|
||||
--timeout The number of [milliseconds] to keep probe
|
||||
sockets open before giving up on the
|
||||
connection.. Default: 1000
|
||||
--psize Set the packet size (payload size).
|
||||
Default: 52
|
||||
--psize Set the payload size. Default: 52
|
||||
--_positionalArg_nexttrace_32 IP Address or domain name
|
||||
--dot-server Use DoT Server for DNS Parse [dnssb,
|
||||
aliyun, dnspod, google, cloudflare]
|
||||
|
||||
@@ -229,7 +229,7 @@ nexttrace --tcp --port 443 2001:4860:4860::8888
|
||||
# UDP Trace
|
||||
nexttrace --udp 1.0.0.1
|
||||
|
||||
# 可以自行指定端口[此处为5353],默认53端口
|
||||
# 可以自行指定端口[此处为5353],默认33494端口
|
||||
nexttrace --udp --port 5353 1.0.0.1
|
||||
```
|
||||
|
||||
@@ -328,16 +328,10 @@ Arguments:
|
||||
-T --tcp Use TCP SYN for tracerouting (default port
|
||||
is 80)
|
||||
-U --udp Use UDP SYN for tracerouting (default port
|
||||
is 53)
|
||||
is 33494)
|
||||
-F --fast-trace One-Key Fast Trace to China ISPs
|
||||
-p --port Set the destination port to use. It is
|
||||
either initial udp port value for
|
||||
"default"method (incremented by each
|
||||
probe, default is 33434), or initial seq
|
||||
for "icmp" (incremented as well, default
|
||||
from 1), or some constantdestination port
|
||||
for other methods (with default of 80 for
|
||||
"tcp", 53 for "udp", etc.)
|
||||
-p --port Set the destination port to use. With
|
||||
default of 80 for "tcp", 33494 for "udp"
|
||||
-q --queries Set the number of probes per each hop.
|
||||
Default: 3
|
||||
--parallel-requests Set ParallelRequests number. It should be
|
||||
@@ -349,9 +343,9 @@ Arguments:
|
||||
IPInfo, IPInsight, IP-API.com, Ip2region,
|
||||
IPInfoLocal, CHUNZHEN, disable-geoip].
|
||||
Default: LeoMoeAPI
|
||||
--pow-provider Choose PoW Provider [api.nxtrace.org, sakura]
|
||||
For China mainland users, please use
|
||||
sakura. Default: api.nxtrace.org
|
||||
--pow-provider Choose PoW Provider [api.nxtrace.org,
|
||||
sakura] For China mainland users, please
|
||||
use sakura. Default: api.nxtrace.org
|
||||
-n --no-rdns Do not resolve IP addresses to their
|
||||
domain names
|
||||
-a --always-rdns Always resolve IP addresses to their
|
||||
@@ -378,16 +372,15 @@ Arguments:
|
||||
-z --send-time Set how many [milliseconds] between
|
||||
sending each packet.. Useful when some
|
||||
routers use rate-limit for ICMP messages.
|
||||
Default: 100
|
||||
Default: 50
|
||||
-i --ttl-time Set how many [milliseconds] between
|
||||
sending packets groups by TTL. Useful when
|
||||
some routers use rate-limit for ICMP
|
||||
messages. Default: 500
|
||||
messages. Default: 50
|
||||
--timeout The number of [milliseconds] to keep probe
|
||||
sockets open before giving up on the
|
||||
connection.. Default: 1000
|
||||
--psize Set the packet size (payload size).
|
||||
Default: 52
|
||||
--psize Set the payload size. Default: 52
|
||||
--_positionalArg_nexttrace_32 IP Address or domain name
|
||||
--dot-server Use DoT Server for DNS Parse [dnssb,
|
||||
aliyun, dnspod, google, cloudflare]
|
||||
|
||||
@@ -32,7 +32,7 @@ func Excute() {
|
||||
ipv4Only := parser.Flag("4", "ipv4", &argparse.Options{Help: "Use IPv4 only"})
|
||||
ipv6Only := parser.Flag("6", "ipv6", &argparse.Options{Help: "Use IPv6 only"})
|
||||
tcp := parser.Flag("T", "tcp", &argparse.Options{Help: "Use TCP SYN for tracerouting (default port is 80)"})
|
||||
udp := parser.Flag("U", "udp", &argparse.Options{Help: "Use UDP SYN for tracerouting (default port is 53)"})
|
||||
udp := parser.Flag("U", "udp", &argparse.Options{Help: "Use UDP SYN for tracerouting (default port is 33494)"})
|
||||
fast_trace := parser.Flag("F", "fast-trace", &argparse.Options{Help: "One-Key Fast Trace to China ISPs"})
|
||||
port := parser.Int("p", "port", &argparse.Options{Help: "Set the destination port to use. With default of 80 for \"tcp\", 33494 for \"udp\""})
|
||||
numMeasurements := parser.Int("q", "queries", &argparse.Options{Default: 3, Help: "Set the number of probes per each hop"})
|
||||
@@ -62,7 +62,7 @@ func Excute() {
|
||||
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"})
|
||||
ttlInterval := parser.Int("i", "ttl-time", &argparse.Options{Default: 50, Help: "Set how many [milliseconds] between sending packets groups by TTL. Useful when some routers use rate-limit for ICMP messages"})
|
||||
timeout := parser.Int("", "timeout", &argparse.Options{Default: 1000, Help: "The number of [milliseconds] to keep probe sockets open before giving up on the connection."})
|
||||
packetSize := parser.Int("", "psize", &argparse.Options{Default: 52, Help: "Set the packet size (payload size)"})
|
||||
packetSize := parser.Int("", "psize", &argparse.Options{Default: 52, Help: "Set the payload size"})
|
||||
str := parser.StringPositional(&argparse.Options{Help: "IP Address or domain name"})
|
||||
dot := parser.Selector("", "dot-server", []string{"dnssb", "aliyun", "dnspod", "google", "cloudflare"}, &argparse.Options{
|
||||
Help: "Use DoT Server for DNS Parse [dnssb, aliyun, dnspod, google, cloudflare]"})
|
||||
|
||||
@@ -279,9 +279,9 @@ func testFile(paramsFastTrace ParamsFastTrace, tm bool) {
|
||||
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)
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes payload\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)
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes payload\n", util.HideIPPart(ip.Ip), paramsFastTrace.MaxHops, paramsFastTrace.PktSize)
|
||||
}
|
||||
var srcAddr string
|
||||
if ip.Version4 {
|
||||
|
||||
@@ -80,12 +80,12 @@ func PrintTraceRouteNav(ip net.IP, domain string, dataOrigin string, maxHops int
|
||||
fmt.Println("IP Geo Data Provider: " + dataOrigin)
|
||||
if util.EnableHidDstIP == "" {
|
||||
if ip.String() == domain {
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", ip.String(), maxHops, packetSize)
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes payload\n", ip.String(), maxHops, packetSize)
|
||||
} else {
|
||||
fmt.Printf("traceroute to %s (%s), %d hops max, %d bytes packets\n", ip.String(), domain, maxHops, packetSize)
|
||||
fmt.Printf("traceroute to %s (%s), %d hops max, %d bytes payload\n", ip.String(), domain, maxHops, packetSize)
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes packets\n", util.HideIPPart(ip.String()), maxHops, packetSize)
|
||||
fmt.Printf("traceroute to %s, %d hops max, %d bytes payload\n", util.HideIPPart(ip.String()), maxHops, packetSize)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,6 +193,9 @@ func (t *UDPTracer) send(ttl int) error {
|
||||
}
|
||||
|
||||
desiredPayloadSize := t.Config.PktSize
|
||||
if desiredPayloadSize-8 > 0 {
|
||||
desiredPayloadSize -= 8
|
||||
}
|
||||
payload := make([]byte, desiredPayloadSize)
|
||||
// 设置随机种子
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
Reference in New Issue
Block a user