From 6e682e1a83bd8020b796a59fc4c2886ef5af9a00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:00:58 +0800 Subject: [PATCH 01/11] =?UTF-8?q?build(deps):=20=E5=8D=87=E7=BA=A7=20x/net?= =?UTF-8?q?=20=E8=87=B3=200.62.0=20(#262)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [golang.org/x/net](https://github.com/golang/net) from 0.61.0 to 0.62.0. - [Commits](https://github.com/golang/net/compare/v0.61.0...v0.62.0) --- updated-dependencies: - dependency-name: golang.org/x/net dependency-version: 0.62.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ef97778..61ca075 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( github.com/tsosunchia/powclient v0.3.0 github.com/xjasonlyu/windivert-go v0.0.0-20201010013527-4239d0afa76f golang.org/x/mod v0.42.0 - golang.org/x/net v0.61.0 + golang.org/x/net v0.62.0 golang.org/x/sync v0.24.0 golang.org/x/sys v0.49.0 golang.org/x/term v0.47.0 diff --git a/go.sum b/go.sum index 40e3dd4..8ce009f 100644 --- a/go.sum +++ b/go.sum @@ -218,8 +218,8 @@ golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= -golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/perf v0.0.0-20260825160852-19be9d8e6c70 h1:M+kM03JKR23KkrutTue5KEQYDSbZTZTJ4FJ1v5zYrHM= From 2a49f7d940aa9c17cc82115d0c8e9fb9e70bcf95 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:01:05 +0800 Subject: [PATCH 02/11] =?UTF-8?q?build(deps):=20=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=20ANSI=20=E4=BE=9D=E8=B5=96=E8=87=B3=200.11.?= =?UTF-8?q?9=20(#263)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [github.com/charmbracelet/x/ansi](https://github.com/charmbracelet/x) from 0.11.6 to 0.11.9. - [Commits](https://github.com/charmbracelet/x/compare/ansi/v0.11.6...ansi/v0.11.9) --- updated-dependencies: - dependency-name: github.com/charmbracelet/x/ansi dependency-version: 0.11.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 61ca075..eed151b 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/akamensky/argparse v1.4.0 github.com/ameshkov/dnscrypt/v2 v2.4.0 github.com/charmbracelet/log v1.0.0 - github.com/charmbracelet/x/ansi v0.11.6 + github.com/charmbracelet/x/ansi v0.11.9 github.com/fatih/color v1.19.0 github.com/gin-gonic/gin v1.12.0 github.com/google/gopacket v1.1.19 @@ -71,7 +71,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.3.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/lucasb-eyer/go-colorful v1.3.0 // indirect + github.com/lucasb-eyer/go-colorful v1.4.1 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 8ce009f..067ad3d 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,8 @@ github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoF github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/log v1.0.0 h1:HVVVMmfOorfj3BA9i8X8UL69Hoz9lI0PYwXfJvOdRc4= github.com/charmbracelet/log v1.0.0/go.mod h1:uYgY3SmLpwJWxmlrPwXvzVYujxis1vAKRV/0VQB7yWA= -github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8= -github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ= +github.com/charmbracelet/x/ansi v0.11.9 h1:kIrqLBxtTVbLyyHO2Evoi93EjQo1mylWmpNEsfPxXAM= +github.com/charmbracelet/x/ansi v0.11.9/go.mod h1:DG/hpOnaI2QJ/KMMqLL2h0KVhluuJLazf8973P+Vy5w= github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI= github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= @@ -104,8 +104,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag= -github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss= +github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= From 662426673b31c618ebd7c8bfad1ccfa0dd6a76fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:01:15 +0800 Subject: [PATCH 03/11] =?UTF-8?q?build(deps):=20=E5=8D=87=E7=BA=A7=20quic-?= =?UTF-8?q?go=20=E8=87=B3=200.65.0=20(#264)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.64.1 to 0.65.0. - [Release notes](https://github.com/quic-go/quic-go/releases) - [Commits](https://github.com/quic-go/quic-go/compare/v0.64.1...v0.65.0) --- updated-dependencies: - dependency-name: github.com/quic-go/quic-go dependency-version: 0.65.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index eed151b..7b5c8c9 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/modelcontextprotocol/go-sdk v1.8.0 github.com/natesales/q v0.19.12 github.com/oschwald/maxminddb-golang v1.13.1 - github.com/quic-go/quic-go v0.64.1 + github.com/quic-go/quic-go v0.65.0 github.com/rodaine/table v1.4.1 github.com/spf13/viper v1.21.0 github.com/sthorne/odoh-go v1.0.4 diff --git a/go.sum b/go.sum index 067ad3d..a146bda 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,8 @@ github.com/quic-go/go-ossfuzz-seeds v0.1.0 h1:APacT+iIaNF6fd8AGEiN3bT/Jtkd2jz4v4 github.com/quic-go/go-ossfuzz-seeds v0.1.0/go.mod h1:3IOHRbJIc+L6YKMwfDtJAM9Vj9k0YY4muhuyUYk5tbk= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= -github.com/quic-go/quic-go v0.64.1 h1:BCNTP+6x6++OPKrGST2FR3f1tycx8O3QOA3QQv09g70= -github.com/quic-go/quic-go v0.64.1/go.mod h1:RAro2j2yN9a9EiPACLHT9IB2NXCvGQmmo/alT0yYI0w= +github.com/quic-go/quic-go v0.65.0 h1:BJQSjdTvLPLmWtaCupUphRbgxgpZhdO/GMpr9Eoe3B4= +github.com/quic-go/quic-go v0.65.0/go.mod h1:RAro2j2yN9a9EiPACLHT9IB2NXCvGQmmo/alT0yYI0w= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rodaine/table v1.4.1 h1:E6biWCzTV91H1sGNlW/cUtqqgxUJnmcThmWAyhPiToo= From 9bb449f4d844161528e2662c0ad582bab44b07d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:01:23 +0800 Subject: [PATCH 04/11] =?UTF-8?q?build(deps):=20=E5=8D=87=E7=BA=A7=20gjson?= =?UTF-8?q?=20=E8=87=B3=201.20.1=20(#266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [github.com/tidwall/gjson](https://github.com/tidwall/gjson) from 1.20.0 to 1.20.1. - [Commits](https://github.com/tidwall/gjson/compare/v1.20.0...v1.20.1) --- updated-dependencies: - dependency-name: github.com/tidwall/gjson dependency-version: 1.20.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 7b5c8c9..f172947 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/sthorne/odoh-go v1.0.4 github.com/stretchr/testify v1.12.1 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 - github.com/tidwall/gjson v1.20.0 + github.com/tidwall/gjson v1.20.1 github.com/tsosunchia/powclient v0.3.0 github.com/xjasonlyu/windivert-go v0.0.0-20201010013527-4239d0afa76f golang.org/x/mod v0.42.0 diff --git a/go.sum b/go.sum index a146bda..6f517d7 100644 --- a/go.sum +++ b/go.sum @@ -176,8 +176,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8 github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= -github.com/tidwall/gjson v1.20.0 h1:+agJ3rEzKcCXKDKo0ml26UROcpcAlnZyjq+TjbY5Fto= -github.com/tidwall/gjson v1.20.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc= +github.com/tidwall/gjson v1.20.1 h1:Jmex4ygKZxn92HFHlejG8sHcEODHttXyrj63hsJ7/GE= +github.com/tidwall/gjson v1.20.1/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc= github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM= github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= From b5ea34ac56547ce91c92bebbb1a41dcf08ae0243 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:01:45 +0800 Subject: [PATCH 05/11] =?UTF-8?q?test(dns):=20=E8=A6=86=E7=9B=96=20HTTP/3?= =?UTF-8?q?=20DoH=20=E6=94=B6=E5=8F=91=E4=B8=8E=E5=A4=8D=E7=94=A8=20(#267)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/dnsclient/transport_http3_test.go | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 internal/dnsclient/transport_http3_test.go diff --git a/internal/dnsclient/transport_http3_test.go b/internal/dnsclient/transport_http3_test.go new file mode 100644 index 0000000..634d955 --- /dev/null +++ b/internal/dnsclient/transport_http3_test.go @@ -0,0 +1,114 @@ +//go:build !flavor_tiny && !flavor_ntr + +package dnsclient + +import ( + "context" + "crypto/tls" + "encoding/base64" + "io" + "net" + "net/http" + "os" + "os/exec" + "testing" + "time" + + "github.com/miekg/dns" + "github.com/natesales/q/cli" + "github.com/quic-go/quic-go/http3" + "github.com/stretchr/testify/require" +) + +const doH3SmokeHelperEnv = "NEXTTRACE_DOH3_SMOKE_HELPER" + +func TestQPublicTransportAgainstLocalDoH3(t *testing.T) { + if os.Getenv(doH3SmokeHelperEnv) != "1" { + // q v0.19.12 closes idle HTTP connections but not the HTTP/3 + // transport's UDP socket. Bound its lifetime to a helper process, + // as well as bounding exchanges that have no context parameter. + ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second) + defer cancel() + command := exec.CommandContext(ctx, os.Args[0], + "-test.run=^TestQPublicTransportAgainstLocalDoH3$", "-test.timeout=10s") + command.Env = append(os.Environ(), doH3SmokeHelperEnv+"=1") + output, err := command.CombinedOutput() + if ctx.Err() != nil { + t.Fatalf("HTTP/3 helper timed out: %v, output=%q", ctx.Err(), output) + } + if err != nil { + t.Fatalf("HTTP/3 helper failed: %v, output=%q", err, output) + } + return + } + + for _, method := range []string{http.MethodGet, http.MethodPost} { + t.Run(method, func(t *testing.T) { + listener, err := net.ListenPacket("udp", "127.0.0.1:0") + require.NoError(t, err) + t.Cleanup(func() { _ = listener.Close() }) + server := &http3.Server{ + TLSConfig: &tls.Config{ + Certificates: []tls.Certificate{testTLSCertificate(t)}, + MinVersion: tls.VersionTLS13, + }, + Handler: http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { + if request.ProtoMajor != 3 || request.Method != method || request.URL.Path != "/dns-query" { + http.Error(writer, "unexpected DNS request", http.StatusBadRequest) + return + } + if request.Header.Get("Accept") != "application/dns-message" { + http.Error(writer, "missing DNS Accept header", http.StatusBadRequest) + return + } + var wire []byte + var readErr error + if method == http.MethodGet { + wire, readErr = base64.RawURLEncoding.DecodeString(request.URL.Query().Get("dns")) + } else { + if request.Header.Get("Content-Type") != "application/dns-message" { + http.Error(writer, "missing DNS Content-Type", http.StatusBadRequest) + return + } + wire, readErr = io.ReadAll(request.Body) + } + query := new(dns.Msg) + if readErr != nil || query.Unpack(wire) != nil { + http.Error(writer, "invalid DNS query", http.StatusBadRequest) + return + } + response, packErr := testDNSReply(query).Pack() + if packErr != nil { + http.Error(writer, packErr.Error(), http.StatusInternalServerError) + return + } + writer.Header().Set("Content-Type", "application/dns-message") + _, _ = writer.Write(response) + }), + } + done := make(chan error, 1) + go func() { done <- server.Serve(listener) }() + t.Cleanup(func() { + _ = server.Close() + select { + case serveErr := <-done: + require.ErrorIs(t, serveErr, http.ErrServerClosed) + case <-time.After(5 * time.Second): + t.Error("HTTP/3 server did not stop") + } + }) + + parsed := mustParseServer(t, "https://"+listener.LocalAddr().String()+"/dns-query") + txp, err := NewTransport(parsed, cli.Flags{ + HTTP3: true, HTTPMethod: method, ReuseConn: true, + }, insecureTestTLSConfig()) + require.NoError(t, err) + t.Cleanup(func() { _ = txp.Close() }) + // A second exchange also exercises the reused HTTP/3 transport. + for range 2 { + reply, exchangeErr := txp.Exchange(testDNSQuery()) + assertTestDNSReply(t, reply, exchangeErr) + } + }) + } +} From c4deee718602cb53398aad46a34687a50b7188d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:03:26 +0800 Subject: [PATCH 06/11] =?UTF-8?q?build(deps):=20=E5=8D=87=E7=BA=A7=20x/syn?= =?UTF-8?q?c=20=E8=87=B3=200.25.0=20(#265)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.24.0 to 0.25.0. - [Commits](https://github.com/golang/sync/compare/v0.24.0...v0.25.0) --- updated-dependencies: - dependency-name: golang.org/x/sync dependency-version: 0.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: tsosunchia <59512455+tsosunchia@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f172947..b496a21 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/xjasonlyu/windivert-go v0.0.0-20201010013527-4239d0afa76f golang.org/x/mod v0.42.0 golang.org/x/net v0.62.0 - golang.org/x/sync v0.24.0 + golang.org/x/sync v0.25.0 golang.org/x/sys v0.49.0 golang.org/x/term v0.47.0 ) diff --git a/go.sum b/go.sum index 6f517d7..ede7a62 100644 --- a/go.sum +++ b/go.sum @@ -225,8 +225,8 @@ golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7 golang.org/x/perf v0.0.0-20260825160852-19be9d8e6c70 h1:M+kM03JKR23KkrutTue5KEQYDSbZTZTJ4FJ1v5zYrHM= golang.org/x/perf v0.0.0-20260825160852-19be9d8e6c70/go.mod h1:ihD/LfJrdVe40PFEzKgix8YPzoXS4LFO4elW9HAFNqo= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= -golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From c76d1da861b89b7e6857d96f88e7a3d2288d972f Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:03:29 +0800 Subject: [PATCH 07/11] =?UTF-8?q?build(go):=20=E5=8D=87=E7=BA=A7=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=8E=E6=9E=84=E5=BB=BA=E5=B7=A5=E5=85=B7=E9=93=BE?= =?UTF-8?q?=E8=87=B3=201.27.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .cross_compile.sh | 2 +- .github/workflows/build.yml | 8 ++++---- .github/workflows/fuzz.yml | 4 ++-- .github/workflows/fwmark.yml | 2 +- .github/workflows/golangci-lint.yml | 4 ++-- .github/workflows/performance.yml | 18 +++++++++--------- .github/workflows/regression.yml | 4 ++-- .github/workflows/test.yml | 12 ++++++------ .github/workflows/tos.yml | 4 ++-- AGENTS.md | 14 +++++++------- README.md | 6 +++--- README_zh_CN.md | 6 +++--- docs/adr/0001-go127-json-runtime.md | 4 ++-- go.mod | 2 +- scripts/perf/generate_pgo_profile.sh | 2 +- scripts/perf/run_pgo_benchmarks.sh | 2 +- 16 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.cross_compile.sh b/.cross_compile.sh index 3904d12..601d42c 100755 --- a/.cross_compile.sh +++ b/.cross_compile.sh @@ -2,7 +2,7 @@ set -Eeuo pipefail -export GOTOOLCHAIN=go1.27.3 +export GOTOOLCHAIN=go1.27.4 # -------- Config -------- # Usage: .cross_compile.sh [full|tiny|ntr|all] [debug] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b00e633..6f5f156 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: - { goos: openbsd, goarch: arm64 } - { goos: openbsd, goarch: arm, goarm: 7 } env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 CGO_ENABLED: ${{ matrix.goos == 'android' && 1 || 0 }} GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} @@ -95,7 +95,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true @@ -226,7 +226,7 @@ jobs: fail-fast: false matrix: { goarch: [ amd64, arm64 ] } env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 CGO_ENABLED: 1 GOOS: darwin GOARCH: ${{ matrix.goarch }} @@ -240,7 +240,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 46263c8..ac5bbb8 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 strategy: fail-fast: false matrix: @@ -50,7 +50,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true diff --git a/.github/workflows/fwmark.yml b/.github/workflows/fwmark.yml index 2e611ad..f660345 100644 --- a/.github/workflows/fwmark.yml +++ b/.github/workflows/fwmark.yml @@ -100,7 +100,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' - name: Install fixture dependencies run: sudo apt-get update && sudo apt-get install -y iproute2 tcpdump - name: Build diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index eb7acbc..88d0f4e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -42,7 +42,7 @@ jobs: name: lint runs-on: ubuntu-latest env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 steps: - name: Checkout codebase uses: actions/checkout@v7 @@ -53,7 +53,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: "1.27.3" + go-version: "1.27.4" check-latest: true cache: true diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml index 66bc41c..5fd4d2b 100644 --- a/.github/workflows/performance.yml +++ b/.github/workflows/performance.yml @@ -325,17 +325,17 @@ jobs: exit 1 fi - - name: Set up head Go 1.27.3 + - name: Set up head Go 1.27.4 uses: actions/setup-go@v7 with: - go-version: "1.27.3" + go-version: "1.27.4" check-latest: true cache: false - name: Record head environment shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 run: | set -Eeuo pipefail result_dir="${RUNNER_TEMP}/performance-evidence/head" @@ -357,7 +357,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 PERF_RESULT_DIR: ${{ runner.temp }}/performance-evidence/head run: bash scripts/perf/run_benchmarks.sh head @@ -366,7 +366,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 run: | set -Eeuo pipefail result_dir="${RUNNER_TEMP}/performance-evidence/head" @@ -379,7 +379,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 PERF_RESULT_DIR: ${{ runner.temp }}/performance-evidence/head run: bash scripts/perf/profile_benchmark.sh ./trace BenchmarkMTRAggregatorSnapshot64TTL4Paths head-mtr @@ -388,7 +388,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 MTR_GOROUTINE_ACTIVE_PROFILE: ${{ runner.temp }}/performance-evidence/head/head-mtr-workers-active.goroutine.pprof MTR_GOROUTINE_LEAK_PROFILE: ${{ runner.temp }}/performance-evidence/head/head-mtr-workers-final.goroutine.pprof run: go test -count=1 -run '^(TestMTRSchedulerJoinsSessionListener|TestMTRWorkerGoroutineProfileCarriesOwnerLabel)$' ./trace @@ -398,7 +398,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 run: | set -Eeuo pipefail result_dir="${RUNNER_TEMP}/performance-evidence/head" @@ -423,7 +423,7 @@ jobs: continue-on-error: true shell: bash env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 REFERENCE_SHA: ${{ steps.refs.outputs.reference_sha }} run: | set -Eeuo pipefail diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 36f0e10..e45c0a3 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -109,7 +109,7 @@ jobs: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 strategy: fail-fast: false matrix: @@ -130,7 +130,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v7 with: - go-version: "1.27.3" + go-version: "1.27.4" check-latest: true cache: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adc1173..97596e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -157,7 +157,7 @@ jobs: name: Default JSON (${{ matrix.os }}) runs-on: ${{ matrix.os }} env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 strategy: fail-fast: false matrix: @@ -173,7 +173,7 @@ jobs: if: ${{ (needs.changes.outputs.go == 'true' || needs.changes.outputs.pty == 'true' || needs.changes.outputs.doctor == 'true' || needs.changes.outputs.dns == 'true') }} uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true @@ -305,7 +305,7 @@ jobs: name: Windows ARM64 IPv6 Traffic Class runs-on: windows-11-arm env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 steps: - name: Checkout codebase uses: actions/checkout@v7 @@ -313,7 +313,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true @@ -326,7 +326,7 @@ jobs: name: Race detector (Ubuntu) runs-on: ubuntu-latest env: - GOTOOLCHAIN: go1.27.3 + GOTOOLCHAIN: go1.27.4 steps: - name: Checkout codebase uses: actions/checkout@v7 @@ -334,7 +334,7 @@ jobs: - name: Set up Go (built-in cache) uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' check-latest: true cache: true diff --git a/.github/workflows/tos.yml b/.github/workflows/tos.yml index 084773b..bb75f4b 100644 --- a/.github/workflows/tos.yml +++ b/.github/workflows/tos.yml @@ -110,7 +110,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' - name: Install Linux fixture dependencies if: runner.os == 'Linux' run: sudo apt-get update && sudo apt-get install -y tcpdump iproute2 @@ -155,7 +155,7 @@ jobs: persist-credentials: false - uses: actions/setup-go@v7 with: - go-version: '1.27.3' + go-version: '1.27.4' - name: Build and prepare the existing WinDivert backend shell: pwsh run: | diff --git a/AGENTS.md b/AGENTS.md index 53aee21..d045f2b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,7 +7,7 @@ - 名称:NextTrace (NTrace-core) - 仓库:github.com/nxtrace/NTrace-core - 模块:`github.com/nxtrace/NTrace-core` -- 语言:Go(`go 1.27.3`) +- 语言:Go(`go 1.27.4`) - 入口:`main.go -> cmd.Execute()` - 核心能力:ICMP/TCP/UDP traceroute、GeoIP/RDNS、MTR 连续探测、Web/API、多平台构建 @@ -381,16 +381,16 @@ ## CI 与工具链(当前) -- `go.mod`: `go 1.27.3`;通过 `tool` directive 固定 `golang.org/x/perf/cmd/benchstat` 版本。 +- `go.mod`: `go 1.27.4`;通过 `tool` directive 固定 `golang.org/x/perf/cmd/benchstat` 版本。 - GitHub Actions: - - `.github/workflows/build.yml` 使用 `setup-go@v7` + `go-version: 1.27.3` - - `.github/workflows/test.yml` 使用 `setup-go@v7` + `go-version: 1.27.3` - - `.github/workflows/regression.yml` 使用 `setup-go@v7` + `go-version: 1.27.3` - - `.github/workflows/golangci-lint.yml` 使用 `setup-go@v7` + `go-version: 1.27.3` + - `.github/workflows/build.yml` 使用 `setup-go@v7` + `go-version: 1.27.4` + - `.github/workflows/test.yml` 使用 `setup-go@v7` + `go-version: 1.27.4` + - `.github/workflows/regression.yml` 使用 `setup-go@v7` + `go-version: 1.27.4` + - `.github/workflows/golangci-lint.yml` 使用 `setup-go@v7` + `go-version: 1.27.4` - test workflow 使用 Go 默认 JSON 运行时,并在 `windows-11-arm` 上运行 IPv6 Traffic Class 专项回归 - 正式发布、性能脚本与 CI 统一使用默认 JSON 后端,不再固定旧实现或维护旧实现测试 lane;源码继续使用 `encoding/json` v1 API - build matrix 已移除 `windows/arm` -- `.cross_compile.sh` 固定 `GOTOOLCHAIN=go1.27.3`,使用默认 JSON 运行时;脚本与 workflow 里的 `go build` 都用数组构造 `-tags` 参数,避免 shell word-splitting;脚本也会把当前 `GOARM` 传给 `compress_with_upx`,使 linux/armv7 目标能命中对应压缩分支。 +- `.cross_compile.sh` 固定 `GOTOOLCHAIN=go1.27.4`,使用默认 JSON 运行时;脚本与 workflow 里的 `go build` 都用数组构造 `-tags` 参数,避免 shell word-splitting;脚本也会把当前 `GOARM` 传给 `compress_with_upx`,使 linux/armv7 目标能命中对应压缩分支。 - Darwin 正式构建最低支持 macOS 13.0:CGO 编译/链接使用 `-mmacosx-version-min=13.0`,Go linker 显式传 `-macos=13.0`。 - `ipgeo/ipdbone.go` 不再原地修改全局 `defaultClient.httpClient.Timeout`;超时覆盖会通过克隆 client(复用 token cache / token init,同步替换整个 HTTP client)实现,避免 dial timeout 与 client timeout 脱节。 diff --git a/README.md b/README.md index bd810fa..a3ceffd 100644 --- a/README.md +++ b/README.md @@ -214,11 +214,11 @@ Starting from this release, NextTrace is published in **three flavors** under th ### Manual Build -Build from source with Go 1.27.3+ installed. Release builds and CI use the +Build from source with Go 1.27.4+ installed. Release builds and CI use the default Go JSON runtime. See the [JSON runtime ADR](docs/adr/0001-go127-json-runtime.md). ```bash -export GOTOOLCHAIN=go1.27.3 +export GOTOOLCHAIN=go1.27.4 # Full (all features) go build -trimpath -o dist/nexttrace -ldflags "-w -s" . @@ -236,7 +236,7 @@ Cross-compile example: ```bash # Linux arm64, Tiny flavor -GOTOOLCHAIN=go1.27.3 \ +GOTOOLCHAIN=go1.27.4 \ GOOS=linux GOARCH=arm64 CGO_ENABLED=0 \ go build -tags flavor_tiny -trimpath -o dist/nexttrace-tiny_linux_arm64 -ldflags "-w -s" . ``` diff --git a/README_zh_CN.md b/README_zh_CN.md index 171f44b..de9bb0f 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -236,11 +236,11 @@ Windows 的 `--dev` 仅用于源地址选择,不能表述为设备绑定已验 ### 手动编译 -需要 Go 1.27.3+ 环境。正式发布与 CI 统一使用 Go 默认 JSON 运行时。 +需要 Go 1.27.4+ 环境。正式发布与 CI 统一使用 Go 默认 JSON 运行时。 详见 [JSON 运行时 ADR](docs/adr/0001-go127-json-runtime.md)。 ```bash -export GOTOOLCHAIN=go1.27.3 +export GOTOOLCHAIN=go1.27.4 # 完整版(所有功能) go build -trimpath -o dist/nexttrace -ldflags "-w -s" . @@ -258,7 +258,7 @@ macOS 源码编译需要 macOS 13.0 或更高版本、Xcode Command Line Tools ```bash # Linux arm64 精简版 -GOTOOLCHAIN=go1.27.3 \ +GOTOOLCHAIN=go1.27.4 \ GOOS=linux GOARCH=arm64 CGO_ENABLED=0 \ go build -tags flavor_tiny -trimpath -o dist/nexttrace-tiny_linux_arm64 -ldflags "-w -s" . ``` diff --git a/docs/adr/0001-go127-json-runtime.md b/docs/adr/0001-go127-json-runtime.md index 7ffce6a..f7d0fc0 100644 --- a/docs/adr/0001-go127-json-runtime.md +++ b/docs/adr/0001-go127-json-runtime.md @@ -2,7 +2,7 @@ - 状态:接受 - 日期:2026-11-01(修订 2026-09-05 决策) -- 工具链:Go 1.27.3 +- 工具链:Go 1.27.4 - Darwin 最低版本:macOS 13.0 ## 背景 @@ -21,7 +21,7 @@ golden 验证字节和语义。JSON 后端的性能取舍结合实际调用量 ## 决策 -1. 项目固定使用 Go 1.27.3,Darwin 正式产物最低支持 macOS 13.0。 +1. 项目固定使用 Go 1.27.4,Darwin 正式产物最低支持 macOS 13.0。 2. 源码继续使用 `encoding/json` v1 API,不直接导入 `encoding/json/v2`。 3. 正式发布、`.cross_compile.sh`、性能和 PGO 脚本统一使用 Go 默认 JSON 后端, 移除 `nojsonv2` 固定项和 PGO 专用 JSON 后端配置。 diff --git a/go.mod b/go.mod index b496a21..39c75df 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/nxtrace/NTrace-core -go 1.27.3 +go 1.27.4 tool golang.org/x/perf/cmd/benchstat diff --git a/scripts/perf/generate_pgo_profile.sh b/scripts/perf/generate_pgo_profile.sh index 0f8f5ad..2a32e3e 100755 --- a/scripts/perf/generate_pgo_profile.sh +++ b/scripts/perf/generate_pgo_profile.sh @@ -9,7 +9,7 @@ RESULT_DIR="${PERF_RESULT_DIR:-${ROOT_DIR}/.cache/perf}" PROFILE_COMPONENT_TIME="${PROFILE_COMPONENT_TIME:-10s}" BENCH_GOMAXPROCS="${BENCH_GOMAXPROCS:-10}" PGO_SEED=20260905 -REQUIRED_GO_VERSION=go1.27.3 +REQUIRED_GO_VERSION=go1.27.4 export GOTOOLCHAIN="${REQUIRED_GO_VERSION}" export GOEXPERIMENT= diff --git a/scripts/perf/run_pgo_benchmarks.sh b/scripts/perf/run_pgo_benchmarks.sh index d0fa05a..ed30616 100755 --- a/scripts/perf/run_pgo_benchmarks.sh +++ b/scripts/perf/run_pgo_benchmarks.sh @@ -15,7 +15,7 @@ RESULT_DIR="${PERF_RESULT_DIR:-${ROOT_DIR}/.cache/perf}" BENCH_COUNT="${BENCH_COUNT:-10}" BENCH_TIME="${BENCH_TIME:-1s}" BENCH_GOMAXPROCS="${BENCH_GOMAXPROCS:-10}" -REQUIRED_GO_VERSION=go1.27.3 +REQUIRED_GO_VERSION=go1.27.4 export GOTOOLCHAIN="${REQUIRED_GO_VERSION}" export GOEXPERIMENT= From 6fdc048d97d9c963daa3bc288b10a446d1ce11ed Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:25:16 +0800 Subject: [PATCH 08/11] =?UTF-8?q?fix(ci):=20=E5=8C=BA=E5=88=86=E8=BF=9C?= =?UTF-8?q?=E7=AB=AF=E7=BC=BA=E6=B5=8B=E5=B9=B6=E9=9A=94=E7=A6=BB=20REST?= =?UTF-8?q?=20=E7=83=9F=E6=B5=8B=E7=9A=84=E5=A4=96=E9=83=A8=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/regression/unix.sh | 10 +++++++++- scripts/regression/windows.ps1 | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/scripts/regression/unix.sh b/scripts/regression/unix.sh index 4fd80b1..ae055dd 100755 --- a/scripts/regression/unix.sh +++ b/scripts/regression/unix.sh @@ -271,6 +271,14 @@ check_json_pure() { record "${name}" SKIP "${note}; external service unavailable" return fi + if [[ "${name}" == json_globalping ]]; then + case "$(tr -d '\r' < "${out}")" in + 'globalping measurement results did not include hop data'|'no matching IPv4 probes available - please try a different location') + record "${name}" SKIP "${note}; external Globalping probe unavailable" + return + ;; + esac + fi if ! allowed_exit_matches "${rc}" "${allowed_csv}"; then record "${name}" FAIL "${note}; exit=${rc}" return @@ -622,7 +630,7 @@ if DEPLOY_BASE_URL="$(wait_deploy_base_url "${DEPLOY_LOG}")" && wait_http_ready else record deploy_options FAIL 'Options API check failed' fi - if curl -fsS --connect-timeout 2 --max-time 5 -X POST -H 'Content-Type: application/json' --data '{"target":"1.1.1.1","queries":1,"max_hops":3,"timeout_ms":1000}' "${DEPLOY_BASE_URL}/api/trace" >"${ART_DIR}/deploy_trace.txt" 2>&1 && grep -Fq '"resolved_ip"' "${ART_DIR}/deploy_trace.txt"; then + if curl -fsS --connect-timeout 2 --max-time 5 -X POST -H 'Content-Type: application/json' --data '{"target":"1.1.1.1","queries":1,"max_hops":3,"timeout_ms":1000,"data_provider":"disable-geoip","disable_rdns":true,"disable_maptrace":true}' "${DEPLOY_BASE_URL}/api/trace" >"${ART_DIR}/deploy_trace.txt" 2>&1 && grep -Fq '"resolved_ip"' "${ART_DIR}/deploy_trace.txt"; then record deploy_trace PASS 'REST trace endpoint works' else record deploy_trace FAIL 'REST trace endpoint failed' diff --git a/scripts/regression/windows.ps1 b/scripts/regression/windows.ps1 index b415237..cd6a2dd 100644 --- a/scripts/regression/windows.ps1 +++ b/scripts/regression/windows.ps1 @@ -440,6 +440,13 @@ function Check-JsonPure { Write-Record $Name SKIP "$Note; external service unavailable" return } + if ($Name -eq "json_globalping" -and ([string]$content).Trim() -in @( + "globalping measurement results did not include hop data", + "no matching IPv4 probes available - please try a different location" + )) { + Write-Record $Name SKIP "$Note; external Globalping probe unavailable" + return + } $sanitizedContent = [regex]::Replace($content, $powLogPattern, "") $bytes = [System.Text.Encoding]::UTF8.GetBytes($sanitizedContent) $first = "" @@ -883,7 +890,7 @@ try { } if ($icmp4Capability.Supported) { try { - $body = '{"target":"1.1.1.1","queries":1,"max_hops":3,"timeout_ms":1000}' + $body = '{"target":"1.1.1.1","queries":1,"max_hops":3,"timeout_ms":1000,"data_provider":"disable-geoip","disable_rdns":true,"disable_maptrace":true}' Invoke-WebRequest -UseBasicParsing -Method Post -ContentType "application/json" -Body $body -Uri "$deployBaseUrl/api/trace" -TimeoutSec 15 | Select-Object -ExpandProperty Content | Tee-Object -FilePath (Join-Path $ArtifactsDir "deploy_trace.txt") | Out-Null $traceBody = Get-Content -Raw -Path (Join-Path $ArtifactsDir "deploy_trace.txt") if ($traceBody.Contains('"resolved_ip"')) { From ac5bb728fec3fb815ea42539267cc3f8d7dda715 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:40:39 +0800 Subject: [PATCH 09/11] =?UTF-8?q?fix(timeout):=20=E5=B0=86=20CLI=20?= =?UTF-8?q?=E5=92=8C=E6=9C=8D=E5=8A=A1=E9=BB=98=E8=AE=A4=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E4=B8=BA=203=20=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++++---- README_zh_CN.md | 8 ++++---- cmd/cmd.go | 4 ++-- cmd/cmd_test.go | 2 +- cmd/nali_mode_test.go | 2 +- internal/service/service.go | 2 +- server/handlers.go | 2 +- skills/nexttrace/references/mcp-tools.md | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index a3ceffd..f47c10a 100644 --- a/README.md +++ b/README.md @@ -622,7 +622,7 @@ export NO_COLOR=1 | `--parallel-requests` | Total in-flight probes across TTLs | `18` | Use `1` on multipath/load-balanced paths; keep `6-18` on stable links | | `--send-time` | Gap between packets inside one TTL group | `50ms` | Raise to `100-200ms` on rate-limited devices; ignored in MTR | | `--ttl-time` | Gap between TTL groups in traceroute; per-hop interval in MTR | traceroute: `300ms`; MTR: `1000ms` when omitted | Lower to speed up; raise on remote/rate-limited paths | -| `--timeout` | Per-probe timeout | `1000ms` | Raise to `2000-3000ms` for intercontinental or high-loss paths | +| `--timeout` | Per-probe timeout | `3000ms` | Increase for intercontinental or high-loss paths | | `--psize` | Probe packet size | Protocol/IP-family minimum | Inclusive IP + probe headers; negative values randomize each probe up to `abs(value)`; sizes above the egress/path MTU may fragment on wire | | `-Q`, `--tos` | IP TOS / traffic class | `0` | Set the full 8-bit IP field (DSCP*4+ECN); nonzero ICMP on Windows amd64 requires `WinDivert` | @@ -1082,9 +1082,9 @@ Arguments: (--mtr/-r/-w, including --raw), this becomes per-hop probe interval. 500-1000ms is a good MTR starting range - --timeout Per-probe timeout [ms]. Raise to 2000-3000 - on slow intercontinental or high-loss - paths. Default: 1000 + --timeout Per-probe timeout [ms]. Increase on slow + intercontinental or high-loss paths. + Default: 3000 --psize Probe packet size in bytes, inclusive IP and active probe headers. Default is the minimum legal size for the chosen protocol diff --git a/README_zh_CN.md b/README_zh_CN.md index de9bb0f..ab032c2 100644 --- a/README_zh_CN.md +++ b/README_zh_CN.md @@ -614,7 +614,7 @@ export NO_COLOR=1 | `--parallel-requests` | 跨 TTL 的总并发 in-flight 探测数 | `18` | 多路径/负载均衡链路用 `1`;稳定链路一般 `6-18` | | `--send-time` | 同一 TTL 组内相邻探测包间隔 | `50ms` | 设备限速时升到 `100-200ms`;MTR 下忽略 | | `--ttl-time` | 常规 traceroute 的 TTL 组间隔;MTR 的每跳探测间隔 | traceroute: `300ms`;MTR: 未指定时 `1000ms` | 想加速就调低;远程/限速链路调高 | -| `--timeout` | 单个探测包超时 | `1000ms` | 跨洲或高丢包链路升到 `2000-3000ms` | +| `--timeout` | 单个探测包超时 | `3000ms` | 跨洲或高丢包链路可适当调高 | | `--psize` | 探测包大小 | 按协议/IP 族自动取最小合法值 | 含 IP + 探测协议头;负值表示每个 probe 在 `abs(value)` 内随机;超过出接口/路径 MTU 时,链路上可能看到分片 | | `-Q`, `--tos` | IP TOS / traffic class | `0` | 设置完整 8 位字段(DSCP*4+ECN);Windows amd64 非零 ICMP TOS 依赖 `WinDivert` | @@ -1058,9 +1058,9 @@ Arguments: (--mtr/-r/-w, including --raw), this becomes per-hop probe interval. 500-1000ms is a good MTR starting range - --timeout Per-probe timeout [ms]. Raise to 2000-3000 - on slow intercontinental or high-loss - paths. Default: 1000 + --timeout Per-probe timeout [ms]. Increase on slow + intercontinental or high-loss paths. + Default: 3000 --psize Probe packet size in bytes, inclusive IP and active probe headers. Default is the minimum legal size for the chosen protocol diff --git a/cmd/cmd.go b/cmd/cmd.go index 8fe1f35..231493a 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -431,7 +431,7 @@ func buildPacketIntervalHelp() string { } func buildTimeoutHelp() string { - return "Per-probe timeout [ms]. Raise to 2000-3000 on slow intercontinental or high-loss paths" + return "Per-probe timeout [ms]. Increase on slow intercontinental or high-loss paths" } func buildPayloadSizeHelp() string { @@ -1465,7 +1465,7 @@ func Execute() { // ── Send-time: hidden in ntr (always ignored in MTR mode) ── packetInterval := registerPacketIntervalFlag(parser) ttlInterval := registerTTLIntervalFlag(parser) - timeout := parser.Int("", "timeout", &argparse.Options{Default: 1000, Help: buildTimeoutHelp()}) + timeout := parser.Int("", "timeout", &argparse.Options{Default: 3000, Help: buildTimeoutHelp()}) packetSize := parser.Int("", "psize", &argparse.Options{Help: buildPayloadSizeHelp()}) tos := parser.Int("Q", "tos", &argparse.Options{Default: 0, Help: buildTOSHelp()}) dot := parser.Selector("", "dot-server", []string{"dnssb", "aliyun", "dnspod", "google", "cloudflare"}, &argparse.Options{ diff --git a/cmd/cmd_test.go b/cmd/cmd_test.go index 9c06b60..314f557 100644 --- a/cmd/cmd_test.go +++ b/cmd/cmd_test.go @@ -1166,7 +1166,7 @@ func TestAdvancedHelpTextMentionsTuningGuidance(t *testing.T) { registerPacketIntervalFlag(parser) parser.Int("", "max-attempts", &argparse.Options{Help: buildMaxAttemptsHelp()}) parser.Int("", "parallel-requests", &argparse.Options{Default: 18, Help: buildParallelRequestsHelp()}) - parser.Int("", "timeout", &argparse.Options{Default: 1000, Help: buildTimeoutHelp()}) + parser.Int("", "timeout", &argparse.Options{Default: 3000, Help: buildTimeoutHelp()}) parser.Int("", "psize", &argparse.Options{Help: buildPayloadSizeHelp()}) usage := parser.Usage(nil) diff --git a/cmd/nali_mode_test.go b/cmd/nali_mode_test.go index 22988eb..74c36f1 100644 --- a/cmd/nali_mode_test.go +++ b/cmd/nali_mode_test.go @@ -126,7 +126,7 @@ func TestBuildNaliModeOptionsDetectsExplicitDefaults(t *testing.T) { parser.Int("", "source-port", &argparse.Options{Default: 0}) parser.Flag("", "show-ips", &argparse.Options{}) parser.Int("y", "ipinfo", &argparse.Options{Default: 0}) - parser.Int("", "timeout", &argparse.Options{Default: 1000}) + parser.Int("", "timeout", &argparse.Options{Default: 3000}) if err := parser.Parse([]string{"nexttrace", "-q", "3", "--max-hops", "30", "-i", "300", "--source-port", "0", "--show-ips", "-y", "0"}); err != nil { t.Fatalf("Parse() error = %v", err) } diff --git a/internal/service/service.go b/internal/service/service.go index a311fec..ed99e19 100644 --- a/internal/service/service.go +++ b/internal/service/service.go @@ -29,7 +29,7 @@ const ( defaultLanguage = "cn" defaultQueries = 3 defaultMaxHops = 30 - defaultTimeoutMs = 1000 + defaultTimeoutMs = 3000 defaultParallelRequests = 18 defaultBeginHop = 1 defaultPacketIntervalMs = 50 diff --git a/server/handlers.go b/server/handlers.go index 8aea7ff..c94b7a9 100644 --- a/server/handlers.go +++ b/server/handlers.go @@ -26,7 +26,7 @@ var ( "protocol": "icmp", "queries": 3, "max_hops": 30, - "timeout_ms": 1000, + "timeout_ms": 3000, "packet_size": nil, "tos": 0, "parallel_requests": 18, diff --git a/skills/nexttrace/references/mcp-tools.md b/skills/nexttrace/references/mcp-tools.md index 8963bff..ad2ce19 100644 --- a/skills/nexttrace/references/mcp-tools.md +++ b/skills/nexttrace/references/mcp-tools.md @@ -33,7 +33,7 @@ Supported: "port": 443, "queries": 3, "max_hops": 30, - "timeout_ms": 1000, + "timeout_ms": 3000, "packet_size": 64, "tos": 0, "parallel_requests": 18, From d60a5c5064d121e840331bd70f4951cafcd3c016 Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:40:39 +0800 Subject: [PATCH 10/11] =?UTF-8?q?fix(nali):=20=E5=AF=B9=E9=BD=90=20API=20v?= =?UTF-8?q?4=20=E6=9F=A5=E8=AF=A2=E4=B8=8E=E7=BC=93=E5=AD=98=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E7=9A=84=E6=9C=80=E4=BD=8E=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/nali_mode.go | 10 +++- cmd/nali_v4_timeout_test.go | 99 ++++++++++++++++++++++++++++++++++ ipgeo/nexttrace_api_v4.go | 10 ++-- ipgeo/nexttrace_api_v4_test.go | 4 +- 4 files changed, 115 insertions(+), 8 deletions(-) create mode 100644 cmd/nali_v4_timeout_test.go diff --git a/cmd/nali_mode.go b/cmd/nali_mode.go index f86244a..0110adb 100644 --- a/cmd/nali_mode.go +++ b/cmd/nali_mode.go @@ -235,9 +235,15 @@ func runNaliMode(ctx context.Context, opts naliRunOptions) error { } else if opts.ipv6Only { family = nali.Family6 } + descriptor := ipgeo.GetSourceDescriptorWithGeoDNS(opts.data, opts.dot) + timeout := time.Duration(opts.timeoutMs) * time.Millisecond + if descriptor.Backend == ipgeo.SourceBackendNextTraceAPIV4 && timeout < ipgeo.NextTraceAPIV4MinTimeout { + // The cache waiter must allow the same minimum budget as the v4 client. + timeout = ipgeo.NextTraceAPIV4MinTimeout + } return nali.Run(ctx, nali.Config{ - Source: trace.CachedGeoSource(ipgeo.GetSourceDescriptorWithGeoDNS(opts.data, opts.dot)), - Timeout: time.Duration(opts.timeoutMs) * time.Millisecond, + Source: trace.CachedGeoSource(descriptor), + Timeout: timeout, Lang: opts.lang, Family: family, DN42: isDN42Provider(opts.data), diff --git a/cmd/nali_v4_timeout_test.go b/cmd/nali_v4_timeout_test.go new file mode 100644 index 0000000..f766249 --- /dev/null +++ b/cmd/nali_v4_timeout_test.go @@ -0,0 +1,99 @@ +package cmd + +import ( + "bytes" + "context" + "crypto/tls" + "io" + "net" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + "time" + + "github.com/nxtrace/NTrace-core/ipgeo" + "github.com/nxtrace/NTrace-core/trace" + "github.com/nxtrace/NTrace-core/util" +) + +func TestRunNaliModeV4WaitsForSlowLookup(t *testing.T) { + for _, tc := range []struct { + name string + timeoutMs int + delay time.Duration + }{ + {name: "short explicit timeout", timeoutMs: 1000, delay: 1200 * time.Millisecond}, + {name: "longer explicit timeout", timeoutMs: 3500, delay: 2200 * time.Millisecond}, + } { + t.Run(tc.name, func(t *testing.T) { + upstream := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/v4/ipGeo" || r.URL.Query().Get("ip") != "218.33.109.164" { + t.Errorf("unexpected GeoIP request: %s", r.URL) + } + time.Sleep(tc.delay) + w.Header().Set("Connection", "close") + _, _ = io.WriteString(w, `{"ip":"218.33.109.164","asnumber":"153371","country":"日本"}`) + })) + defer upstream.Close() + proxy := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodConnect || r.Host != "api.nxtrace.org:443" { + t.Errorf("unexpected proxy request: %s %s", r.Method, r.Host) + http.Error(w, "unexpected proxy request", http.StatusBadRequest) + return + } + remote, err := net.Dial("tcp", upstream.Listener.Addr().String()) + if err != nil { + t.Error(err) + return + } + defer remote.Close() + client, _, err := w.(http.Hijacker).Hijack() + if err != nil { + t.Error(err) + return + } + defer client.Close() + _, _ = io.WriteString(client, "HTTP/1.1 200 Connection Established\r\n\r\n") + go func() { _, _ = io.Copy(remote, client) }() + _, _ = io.Copy(client, remote) + })) + defer proxy.Close() + + oldProxy, oldTransport := util.EnvProxyURL, http.DefaultTransport + oldPolicy := util.CurrentGeoDNSPolicy() + proxyURL, err := url.Parse(proxy.URL) + if err != nil { + t.Fatal(err) + } + transport := http.DefaultTransport.(*http.Transport).Clone() + // All TLS connections are tunneled to the local test server. + transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + transport.Proxy = http.ProxyURL(proxyURL) + http.DefaultTransport = transport + util.EnvProxyURL = proxy.URL + t.Setenv(util.EnvNextTraceAPIV4TokenKey, "test-token") + trace.ClearCaches() + t.Cleanup(func() { + util.EnvProxyURL, http.DefaultTransport = oldProxy, oldTransport + util.SetGeoDNSResolver(oldPolicy.Resolver()) + transport.CloseIdleConnections() + trace.ClearCaches() + }) + + var out bytes.Buffer + err = runNaliMode(context.Background(), naliRunOptions{ + stdout: &out, data: ipgeo.NextTraceAPIProvider, pow: "api.nxtrace.org", + dot: strings.TrimPrefix(proxy.URL, "http://"), lang: "cn", + timeoutMs: tc.timeoutMs, target: "218.33.109.164", + }) + if err != nil { + t.Fatalf("runNaliMode() error = %v", err) + } + if got, want := out.String(), "218.33.109.164 [AS153371, 日本]\n"; got != want { + t.Fatalf("runNaliMode() output = %q, want %q", got, want) + } + }) + } +} diff --git a/ipgeo/nexttrace_api_v4.go b/ipgeo/nexttrace_api_v4.go index 9049847..bba7cb4 100644 --- a/ipgeo/nexttrace_api_v4.go +++ b/ipgeo/nexttrace_api_v4.go @@ -18,6 +18,9 @@ import ( "golang.org/x/net/http/httpproxy" ) +// NextTraceAPIV4MinTimeout is the minimum total budget for a v4 GeoIP lookup. +const NextTraceAPIV4MinTimeout = 2 * time.Second + const ( NextTraceAPIV4TokenPageURL = "https://api.nxtrace.org/v4/api-tokens" nextTraceAPIV4APIHost = "api.nxtrace.org" @@ -26,7 +29,6 @@ const ( nextTraceAPIV4TokenHeader = "X-NextTrace-Token" nextTraceAPIV4MaxErrorBody = 512 nextTraceAPIV4MaxGeoBody = 1 << 20 - nextTraceAPIV4MinTimeout = 2 * time.Second nextTraceAPIV4FastIPTimeout = time.Second nextTraceAPIV4MaxAttempts = 3 nextTraceAPIV4CacheMaxSize = 32 @@ -76,7 +78,7 @@ type NextTraceAPIV4Client struct { func NewNextTraceAPIV4Client(endpoint string, token string, httpClient *http.Client) *NextTraceAPIV4Client { endpoint = normalizeNextTraceAPIV4Endpoint(endpoint) if httpClient == nil { - httpClient = defaultNextTraceAPIV4HTTPClient(endpoint, nextTraceAPIV4MinTimeout) + httpClient = defaultNextTraceAPIV4HTTPClient(endpoint, NextTraceAPIV4MinTimeout) } return &NextTraceAPIV4Client{ endpoint: endpoint, @@ -514,8 +516,8 @@ func sleepBeforeNextTraceAPIV4Retry(ctx context.Context, delay time.Duration) er } func normalizeNextTraceAPIV4Timeout(timeout time.Duration) time.Duration { - if timeout < nextTraceAPIV4MinTimeout { - return nextTraceAPIV4MinTimeout + if timeout < NextTraceAPIV4MinTimeout { + return NextTraceAPIV4MinTimeout } return timeout } diff --git a/ipgeo/nexttrace_api_v4_test.go b/ipgeo/nexttrace_api_v4_test.go index aa5848d..2869cb1 100644 --- a/ipgeo/nexttrace_api_v4_test.go +++ b/ipgeo/nexttrace_api_v4_test.go @@ -1273,8 +1273,8 @@ func TestNewNextTraceAPIV4ClientDefaultsBoundedHTTPClient(t *testing.T) { if client.httpClient == nil { t.Fatal("httpClient = nil, want bounded default client") } - if client.httpClient.Timeout < nextTraceAPIV4MinTimeout { - t.Fatalf("httpClient.Timeout = %s, want at least %s", client.httpClient.Timeout, nextTraceAPIV4MinTimeout) + if client.httpClient.Timeout < NextTraceAPIV4MinTimeout { + t.Fatalf("httpClient.Timeout = %s, want at least %s", client.httpClient.Timeout, NextTraceAPIV4MinTimeout) } if client.httpClient == http.DefaultClient { t.Fatal("httpClient = http.DefaultClient, want bounded default client") From 09c8168499dd0a96c3d0f5e865b952493d9e08eb Mon Sep 17 00:00:00 2001 From: tsosunchia <59512455+tsosunchia@users.noreply.github.com> Date: Sat, 14 Nov 2026 21:44:06 +0800 Subject: [PATCH 11/11] =?UTF-8?q?test(nali):=20=E6=98=BE=E5=BC=8F=E5=BF=BD?= =?UTF-8?q?=E7=95=A5=E4=BB=A3=E7=90=86=E6=B5=8B=E8=AF=95=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E7=9A=84=E5=85=B3=E9=97=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/nali_v4_timeout_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/nali_v4_timeout_test.go b/cmd/nali_v4_timeout_test.go index f766249..c1858a4 100644 --- a/cmd/nali_v4_timeout_test.go +++ b/cmd/nali_v4_timeout_test.go @@ -48,13 +48,13 @@ func TestRunNaliModeV4WaitsForSlowLookup(t *testing.T) { t.Error(err) return } - defer remote.Close() + defer func() { _ = remote.Close() }() client, _, err := w.(http.Hijacker).Hijack() if err != nil { t.Error(err) return } - defer client.Close() + defer func() { _ = client.Close() }() _, _ = io.WriteString(client, "HTTP/1.1 200 Connection Established\r\n\r\n") go func() { _, _ = io.Copy(remote, client) }() _, _ = io.Copy(client, remote)