4 ms·
If the DoH server is hosted on Cloudflare we can use ESNI to send DoH queries. Below is simple example using ESNI-enabled openssl.^1 Cloudflare ESNI works nic
by 1vuio0pswjnm7 6y ago
If the DoH server is hosted on Cloudflare we can use ESNI to send DoH queries.
Below is simple example using ESNI-enabled openssl.^1
Cloudflare ESNI works nicely for me. Very fast. YMMV.
1. https://github.com/sftcd/openssl/tree/master/esnistuff https://github.com/sftcd/openssl/tree/master/esnistuff
# requirements: openssl-esni-2019-08-30 drill sed grep od tr
# get an ESNI key
(
printf 'GET /dns-query?name=_esni.www.cloudflare.com&type=TXT&ct=application/dns-json HTTP/1.1\r\n';
printf 'Host: cloudflare-dns.com\r\n';
printf 'Connection: close\r\n';
printf '\r\n';
) |openssl s_client -4 -noservername -ign_eof -connect 104.16.249.249:443 2>/dev/null \
|grep -o "data\":\"[^}]*"|sed -n s'/.\{9\}//;s/=.*/=/;wESNIRR'
# make a DNS request for the name "doh.crypto.sx" over HTTPS using GET method
read k < ESNIRR;
h=doh.crypto.sx;
(
printf 'GET /dns-query?dns=AAABAAABAAAAAAAAA2RvaAZjcnlwdG8Cc3gAAAEAAQ HTTP/1.1\r\n';
printf 'Host: doh.crypto.sx\r\n';
printf 'Connection: close\r\n';
printf 'Accept: application/dns-message\r\n';
printf '\r\n'
)|LD_LIBRARY_PATH=./openssl-esni-2019-08-30 ./openssl-esni-2019-08-30/apps/openssl \
s_client -4 -tls1_3 -noservername -ign_eof -connect 104.16.249.249:443 -esni $h -esnirr $k 2>/dev/null > pkt
od -An -tx1 -vw3000000 < pkt|tr -d '\40'|sed 's/00008[15]8[03]000[01]00/\
&/g'|drill -i/dev/stdin 2>/dev/null;
rm pkt ESNIRR;
unset h;