Files
ZacharyZcR 8d30ee334c
测试构建 / 代码检查 (push) Has been cancelled
测试构建 / 单元测试和构建 (push) Has been cancelled
测试构建 / 构建验证 (push) Has been cancelled
Add native protocol service plugins
2026-05-23 15:51:50 +08:00

20 lines
442 B
Go

//go:build plugin_dnstcp || !plugin_selective
package services
import (
"encoding/binary"
"testing"
)
func TestDNSTCPFrame(t *testing.T) {
query := buildDNSRootNSQuery(0x4321)
frame := make([]byte, 2, len(query)+2)
binary.BigEndian.PutUint16(frame, uint16(len(query)))
frame = append(frame, query...)
if binary.BigEndian.Uint16(frame[:2]) != uint16(len(query)) {
t.Fatalf("unexpected dns tcp length prefix: %#v", frame[:2])
}
}