Skip to content

Instantly share code, notes, and snippets.

View vavrusa's full-sized avatar

Marek Vavruša vavrusa

View GitHub Profile
@vavrusa
vavrusa / kresolved-minim
Last active October 7, 2015 17:14
How Knot DNS Resolved minimizes
## How it deals with bad CDNs
The query is `who.ami.here.com. A`
1. It's going to ask at `.` to `com. NS` and get a referral
2. it's going to ask `com.` nameserver about `here.com. NS` and get a referral
... see the pattern, it just appends labels, but bear with me
3. We're asking `here.com` nameserver about `ami.here.com. NS` , but he's a prick and tells us 'NXDOMAIN'.
3 0.979429111596
4 0.979429111596
5 0.979429111596
6 0.979429111596
7 0.979429111596
8 0.979429111596
9 0.979429111596
10 0.979429111596
11 0.979429111596
12 0.979429111596
@vavrusa
vavrusa / bind11.js
Last active December 18, 2016 11:48
BIND11
var net = require('net');
var dgram = require('dgram');
function ntohs(arr) {
return ((arr[0] & 0xFF) << 8) | (arr[1] & 0xFF);
}
function parse_name(data, pos)
{
for (base = pos; pos < data.length;) {