Skip to content

Commit 35d65b1

Browse files
committed
Randomize prism response size between 75-100% of MTU
1 parent 4864aa6 commit 35d65b1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/dnsrouter/verify.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ func (r *Router) handleVerify(packet []byte, clientAddr *net.UDPAddr) bool {
117117
respHMAC := mac2.Sum(nil) // 32 bytes
118118

119119
// Build raw binary TXT payload: 32-byte HMAC + random binary padding.
120-
// Pad to the tunnel's configured MTU so the response matches what
121-
// dnstt-server would produce at full capacity.
122-
targetTotal := vr.mtu
120+
// Randomize around the tunnel's MTU to match natural dnstt variation
121+
// (real responses vary based on how much tunnel data is available).
122+
targetTotal := vr.mtu - randInt(vr.mtu/4) // 75%-100% of MTU
123123
if targetTotal < 200 {
124124
targetTotal = 200
125125
}

0 commit comments

Comments
 (0)