Skip to content

Instantly share code, notes, and snippets.

View ahupowerdns's full-sized avatar

bert hubert ahupowerdns

View GitHub Profile
fig, ax = plt.subplots()
xdata, ydata = [], []
hi, = plt.plot([], [], 'ro')
ax.grid()
Writer = animation.writers['ffmpeg']
writer = Writer(fps=7, metadata=dict(artist='bert hubert'), bitrate=2500)
def init():
#!/bin/bash
for a in {1774..2080}
do for b in {0..6}
do
wget http://navigation-office.esa.int/products/gnss-products/$a/esr${a}$b.erp.Z
done
done
zcat esr20805.erp.Z | grep MJD > erp.csv
zcat *.Z | grep ^5 | sort -n >> erp.raw
// g++ syncio.cc -o syncio -std=c++11
#include <iostream>
#include <thread>
#include <string>
#include <unistd.h>
using namespace std;
void theThread()
{

dnsdist has a built-in cache that is 1) really fast 2) saves a lot of packets from being sent.

the recursor supports EDNS Client Subnet where it feeds part of the client IP address to authoritative servers, to get better answers

If the recursor is hidden behind dnsdist, dnsdist can be configured to send on part of the client IP address to the recursor. So ECS then gets used twice: once to the recursor, once to the authoritative server.

When this setup is enabled, the dnsdist cache contains packets with the ECS option on the question. This means the cache hitrate goes down tremendously, as it will only deliver 'hits' within the same /24 (say).

When ECS is enabled, most domains are still not ECS-variable. This means we have split up the cache into thousands of /24 shards for no good reason.

#include <algorithm>
#include <vector>
#include <parallel/algorithm>
using namespace std;
extern "C" int cmp(const void* a, const void* b)
{
return *(int*)a < *(int*)b;
}
@ahupowerdns
ahupowerdns / h2o-dnsdist.md
Last active June 7, 2018 13:52
H2O dnsdist usecase

h2o 2.2.5

So it is likely I am doing it wrong, or that I have unrealistic expectations.

The repo is: https://github.com/ahupowerdns/pdns/tree/dnsdist-doh The file with all the H2O in there: https://github.com/ahupowerdns/pdns/blob/dnsdist-doh/pdns/dnsdistdist/doh.cc

The model is that I register a handler (in register_handler). This receives DNS over HTTPS requests, in the function doh_handler, and forwards these queries to a DNS thread which does no h2o interactions. Crucially, it forwards the h2o_req_t pointer to that thread too.

This separate DNS thread does its thing, and then forwards the answer to yet another thread that receives DNS responses and feeds them back to h2o. This sender thread receives the h2o_req_t pointer that was originally sent from the doh_handler and uses it to send the response.

$ORIGIN .
v6.powerdns.org 3600 IN NS lua-ns-v6.powerdns.org.
v6.powerdns.org 3600 IN SOA lua-ns-v6.powerdns.org hostmaster.v6.powerdns.org 1 10800 3600 604800 3600
whoami-ecs.v6.powerdns.org 60 IN LUA TXT "'ip: '..who:toString()..', netmask: '..(ecswho and ecswho:toString() or 'no ECS')"
whoami-port.v6.powerdns.org 60 IN LUA TXT "who:toStringWithPort()"
whoami.v6.powerdns.org 60 IN LUA AAAA "who:toString()"
whoami.v6.powerdns.org 60 IN LUA TXT "who:toString()"
;;;;;;;;;;;;;;
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.axis text {
font: 10px sans-serif;
text-anchor: middle; /* or start or end */
}
#include <atomic>
#include <iostream>
/* goal, replace:
if(x < 1)
++c0_1;
else if(x < 10)
++c1_10;
else if(x< 100)
++c10_100;
#include <atomic>
#include <iostream>
/* goal, replace:
if(x < 1)
++c0_1;
else if(x < 10)
++c1_10;
else if(x< 100)
++c10_100;