mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-11-28 15:44:00 +00:00
保留完整 8 位 TOS 参数,传播初始化失败,修复 Linux 策略路由选源与 MTR socket 轮换,并为 Windows 非零 ICMPv4 TOS 使用 WinDivert。补齐三平台抓包、Linux 隔离路由验收及平台文档。
23 lines
574 B
Go
23 lines
574 B
Go
//go:build linux && !android
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net"
|
|
"testing"
|
|
|
|
"github.com/nxtrace/NTrace-core/trace"
|
|
)
|
|
|
|
func TestCLIRejectsFailedTOSRouteBeforeFallback(t *testing.T) {
|
|
ctx, cancel := context.WithCancel(t.Context())
|
|
cancel()
|
|
cfg := trace.Config{Context: ctx, DstIP: net.ParseIP("127.0.0.1"), TOS: 184}
|
|
got, err := resolveCLIProbeSource(trace.ICMPTrace, cfg)
|
|
if trace.IsInitializationError(err) || !errors.Is(err, context.Canceled) || got.SrcAddr != "" {
|
|
t.Fatalf("CLI used fallback source after failed TOS route: %+v %v", got, err)
|
|
}
|
|
}
|