Commit 57f41d60 authored by Jiří Helebrant's avatar Jiří Helebrant

DoH (binary) support (not yet used by default), CZ.NIC ODVR as a default server, npm deps upgrade

parent dbe47917
Pipeline #48804 passed with stages
in 3 minutes and 11 seconds
{
"supportedProtocols": ["http:", "https:", "ws:", "wss:", "ftp:", "ftps:"],
"tlsDns": [
"DoHservers": [
{ "name": "CZ.NIC", "url": "https://odvr.nic.cz/doh" },
{ "name": "CloudFlare", "url": "https://cloudflare-dns.com/dns-query" },
{ "name": "Google", "url": "https://dns.google.com/resolve" },
{ "name": "Google", "url": "https://dns.google.com/experimental" },
{ "name": "Quad9", "url": "https://dns9.quad9.net/dns-query" }
],
"defaultTTL": 1200,
......@@ -15,11 +16,7 @@
"badRsa": "bad-rsa.test-ipv6.nic.cz",
"badEcdsa": "bad-ecdsa.test-ipv6.nic.cz"
},
"dnssecWhitelist": [
"bad-rsa.test-ipv6.nic.cz",
"bad-ecdsa.test-ipv6.nic.cz",
"bad.udp53.cz"
],
"dnssecWhitelist": ["bad-rsa.test-ipv6.nic.cz", "bad-ecdsa.test-ipv6.nic.cz", "bad.udp53.cz"],
"colors": {
"red": "#ff0016",
"green": "#00cc55",
......@@ -30,7 +27,7 @@
},
"blockInvalid": true,
"blockUnsigned": false,
"tlsDns": "https://cloudflare-dns.com/dns-query",
"DoHserver": "https://odvr.nic.cz/doh",
"cacheTime": {
"resolver": 60,
"domain": 60
......
......@@ -28,10 +28,10 @@
</section>
<section class="form-section">
<h3>DNS-over-HTTP server</h3>
<label><input type="radio" name="tlsDns" /> Cloudflare</label>
<label><input type="radio" name="tlsDns" /> Google</label>
<label><input type="radio" name="DoHserver" /> Cloudflare</label>
<label><input type="radio" name="DoHserver" /> Google</label>
<label class="advanced"
><input type="radio" name="tlsDns" value="_custom_"/> custom:
><input type="radio" name="DoHserver" value="_custom_"/> custom:
<input type="text" id="tlsDnsCustom"
/></label>
</section>
......
const dnspacket = require('native-dns-packet')
const Buffer = require('buffer/').Buffer
const dohQuery = (server, b64packet) =>
fetch(`${server}?dns=${b64packet}`, {
Headers: {
Accept: 'application/dns-message',
'Content-type': 'application/dns-message'
}
})
.then(r => r.arrayBuffer())
.then(b => dnspacket.parse(Buffer.from(b)))
.catch(e => {
console.error(e)
})
const makeDnsPacket = (name, type = 1) => {
const buff = new Buffer(4096)
const size = dnspacket.write(buff, {
header: {
rd: 1
},
question: [{ class: 1, name, type }],
answer: [],
authority: [],
additional: [],
edns_options: [],
payload: undefined
})
const packet = buff.slice(0, size)
return btoa(packet).replace(/={1,2}$/, '')
}
export { makeDnsPacket, dohQuery }
......@@ -8,7 +8,7 @@ const getTTL = j =>
: config.defaultSettings.cacheTime.domain
const resolveDnssecStatus = async hostname =>
fetch(`${config.tlsDns[0].url}?name=${hostname}&cd=0`, {
fetch(`${config.DoHservers[0].url}?name=${hostname}&cd=0`, {
// https://developers.cloudflare.com/1.1.1.1/dns-over-https/json-format/
headers: { accept: 'application/dns-json' }
})
......
......@@ -6,7 +6,7 @@ import Url from 'url-parse'
// import settingsStore from './settings'
const protocols = config.supportedProtocols
const dnsHost = new Url(config.tlsDns[0].url).hostname
const dnsHost = new Url(config.DoHservers[0].url).hostname
const blockRequest = async tabId => {
await storage('tabCounters', 'inc', { id: tabId })
......
......@@ -23,6 +23,9 @@ module.exports = {
}
]
})
config.node = {
process: true
}
return config
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment