fix: transport.UDPConn 新增了 WithUDPLinuxTimestamping(false) 开关

This commit is contained in:
2026-03-27 01:59:17 +08:00
parent 5b231141a7
commit 8cec6a0766
7 changed files with 154 additions and 37 deletions

View File

@@ -13,10 +13,11 @@ import (
func main() {
listenAddr := flag.String("listen", ":9001", "UDP server listen address")
logPath := flag.String("latency-log", "", "optional JSONL file path for latency timestamp logs")
txTimestampDebugLogPath := flag.String("tx-ts-debug-log", "", "optional JSONL file path for TX errqueue debug records")
txTimestampDebugLogPath := flag.String("tx-ts-debug-log", "", "optional JSONL file path for TX errqueue debug records; enables Linux UDP timestamping")
flag.Parse()
hubOptions := make([]server.UDPOption, 0, 2)
hubOptions = append(hubOptions, server.WithUDPLinuxTimestamping(false))
if *logPath != "" {
logger, err := latencylog.NewJSONLLogger(*logPath)
if err != nil {
@@ -31,6 +32,7 @@ func main() {
log.Fatalf("create tx timestamp debug logger %s: %v", *txTimestampDebugLogPath, err)
}
defer logger.Close()
hubOptions = append(hubOptions, server.WithUDPLinuxTimestamping(true))
hubOptions = append(hubOptions, server.WithUDPTXTimestampDebugLogger(logger))
}