feat(dns): 组合 q 公共子包提供 DNS 客户端

- 仅在 full flavor 注册 -l/--dns 独占终端模式
- 锁定 q v0.19.12 并加入差分、fatal 与 flavor 隔离门禁
- 记录架构、体积、许可证、升级协议与已知风险
This commit is contained in:
tsosunchia committed 2026-07-27 16:35:43 +08:00
1 parent 0bcc54955d
commit 09b9ff5f14
29 files changed
+5003 -17

No files matched your search

+43 -10
View File
@@ -157,26 +157,47 @@ jobs:
BUILD_ARGS+=( -o "dist/${NAME}" -ldflags "$LD_BASE" )
echo "build => dist/${NAME} (tags: ${TAGS:-none})"
go build "${BUILD_ARGS[@]}"
if command -v upx >/dev/null 2>&1; then
case "${GOOS}-${GOARCH}-${GOARM:-}" in
linux-amd64-*|linux-386-*|linux-arm64-*|linux-arm-7) upx -9 "dist/${NAME}" ;;
*) ;;
esac
fi
done
- name: Verify tiny/ntr decoupling
run: |
set -Eeuo pipefail
for TAGS in "flavor_tiny" "flavor_ntr"; do
DEPS="$(go list -deps -tags "${TAGS}" .)"
if grep -qE '^github\.com/natesales/q($|/)' <<<"${DEPS}"; then
echo "FAIL: ${TAGS} compile dependency graph contains q"
exit 1
fi
done
for BIN in "nexttrace-tiny" "ntr"; do
FNAME="${BIN}_${PLATFORM}${EXT}${SOFT}"
if go version -m "dist/${FNAME}" 2>/dev/null | grep -qE 'github\.com/gin-gonic/gin|github\.com/jsdelivr/globalping-cli'; then
echo "FAIL: ${FNAME} contains gin or globalping-cli dependency"
if ! BUILD_INFO="$(go version -m "dist/${FNAME}" 2>&1)"; then
echo "FAIL: unable to read Go build info from ${FNAME}"
echo "${BUILD_INFO}"
exit 1
fi
if grep -qE 'github\.com/gin-gonic/gin|github\.com/jsdelivr/globalping-cli|github\.com/natesales/q' <<<"${BUILD_INFO}"; then
echo "FAIL: ${FNAME} contains gin, globalping-cli, or q dependency"
exit 1
fi
done
echo "Decoupling check passed"
- name: Compress selected Linux artifacts
if: >
matrix.goos == 'linux' && (
matrix.goarch == 'amd64' ||
matrix.goarch == '386' ||
matrix.goarch == 'arm64' ||
(matrix.goarch == 'arm' && matrix.goarm == '7')
)
run: |
set -Eeuo pipefail
for BIN in "nexttrace" "nexttrace-tiny" "ntr"; do
FNAME="${BIN}_${PLATFORM}${EXT}${SOFT}"
upx -9 "dist/${FNAME}"
done
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
@@ -265,10 +286,22 @@ jobs:
- name: Verify tiny/ntr decoupling
run: |
set -Eeuo pipefail
for TAGS in "flavor_tiny" "flavor_ntr"; do
DEPS="$(go list -deps -tags "${TAGS}" .)"
if grep -qE '^github\.com/natesales/q($|/)' <<<"${DEPS}"; then
echo "FAIL: ${TAGS} compile dependency graph contains q"
exit 1
fi
done
for BIN in "nexttrace-tiny" "ntr"; do
FNAME="${BIN}_${GOOS}_${GOARCH}"
if go version -m "dist/${FNAME}" 2>/dev/null | grep -qE 'github\.com/gin-gonic/gin|github\.com/jsdelivr/globalping-cli'; then
echo "FAIL: ${FNAME} contains gin or globalping-cli dependency"
if ! BUILD_INFO="$(go version -m "dist/${FNAME}" 2>&1)"; then
echo "FAIL: unable to read Go build info from ${FNAME}"
echo "${BUILD_INFO}"
exit 1
fi
if grep -qE 'github\.com/gin-gonic/gin|github\.com/jsdelivr/globalping-cli|github\.com/natesales/q' <<<"${BUILD_INFO}"; then
echo "FAIL: ${FNAME} contains gin, globalping-cli, or q dependency"
exit 1
fi
done
+10
View File
@@ -57,6 +57,16 @@ jobs:
sudo go env -w GOTOOLCHAIN=go1.26.4+auto
sudo go test -v -covermode=count -coverprofile='coverage.out' ./...
- name: Verify q v0.19.12 adapter parity
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
run: |
go mod download github.com/natesales/q@v0.19.12
Q_SOURCE="$(go env GOMODCACHE)/github.com/natesales/q@v0.19.12"
(cd "${Q_SOURCE}" && go build -trimpath -o "${RUNNER_TEMP}/q-v0.19.12" .)
NEXTTRACE_Q_REFERENCE_BINARY="${RUNNER_TEMP}/q-v0.19.12" \
go test ./internal/dnsclient -run '^TestPinnedQ' -count=1
- name: Smoke test nt_install.sh
if: ${{ matrix.os != 'windows-latest' }}
shell: bash