mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-12-02 01:11:51 +00:00
fix(globalping): 修正 MCP ICMP 默认端口
This commit is contained in:
1 parent
ae743ebca2
commit
bfe1f66b7a
2 files changed
+5
-2
No files matched your search
@@ -124,6 +124,9 @@ func buildGlobalpingCreate(req GlobalpingTraceRequest) (*globalping.MeasurementC
|
||||
|
||||
func defaultGlobalpingPort(protocol string) int {
|
||||
switch protocol {
|
||||
case "ICMP":
|
||||
// Globalping's CLI model always serializes port; probes reject port 0 even for ICMP MTR.
|
||||
return 80
|
||||
case "TCP":
|
||||
return 80
|
||||
case "UDP":
|
||||
|
||||
@@ -36,12 +36,12 @@ func TestBuildGlobalpingCreateUsesLocationsAndOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildGlobalpingCreateDefaultsTCPUDPPorts(t *testing.T) {
|
||||
func TestBuildGlobalpingCreateDefaultsPorts(t *testing.T) {
|
||||
tests := []struct {
|
||||
protocol string
|
||||
wantPort uint16
|
||||
}{
|
||||
{protocol: "icmp", wantPort: 0},
|
||||
{protocol: "icmp", wantPort: 80},
|
||||
{protocol: "tcp", wantPort: 80},
|
||||
{protocol: "udp", wantPort: 33494},
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user