mafintosh / mafintosh/dns-socket

Support TCP fallback

Open
#11 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
106
Forks
18
PR merge metrics
No merged PRs in 30d

Description

When the response size exceeds 512 byte, a DNS server will reply with the TC flag set, which indicates the client should retry the query over TCP. From https://tools.ietf.org/html/rfc5966:

>the normal behaviour of any DNS server needing to send a UDP response that would exceed the 512-byte limit is for the server to truncate the response so that it fits within that limit and then set the TC flag in the response header. When the client receives such a response, it takes the TC flag as an indication that it should retry over TCP instead.

Example query:

````js
require(".")().query({
questions: [{
type: 'TXT',
name: 'longtxt.silverwind.io'
}]
}, 53, '8.8.8.8', console.log)
````

The response object will have `flag_trunc` property set which indicates TCP should be attempted.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the example query in the issue and inspect how the response's `flag_trunc` property is produced and handled. The work is done when a truncated UDP response triggers a retry over TCP and the query returns the TCP response.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.