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:"], "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": "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" } { "name": "Quad9", "url": "https://dns9.quad9.net/dns-query" }
], ],
"defaultTTL": 1200, "defaultTTL": 1200,
...@@ -15,11 +16,7 @@ ...@@ -15,11 +16,7 @@
"badRsa": "bad-rsa.test-ipv6.nic.cz", "badRsa": "bad-rsa.test-ipv6.nic.cz",
"badEcdsa": "bad-ecdsa.test-ipv6.nic.cz" "badEcdsa": "bad-ecdsa.test-ipv6.nic.cz"
}, },
"dnssecWhitelist": [ "dnssecWhitelist": ["bad-rsa.test-ipv6.nic.cz", "bad-ecdsa.test-ipv6.nic.cz", "bad.udp53.cz"],
"bad-rsa.test-ipv6.nic.cz",
"bad-ecdsa.test-ipv6.nic.cz",
"bad.udp53.cz"
],
"colors": { "colors": {
"red": "#ff0016", "red": "#ff0016",
"green": "#00cc55", "green": "#00cc55",
...@@ -30,7 +27,7 @@ ...@@ -30,7 +27,7 @@
}, },
"blockInvalid": true, "blockInvalid": true,
"blockUnsigned": false, "blockUnsigned": false,
"tlsDns": "https://cloudflare-dns.com/dns-query", "DoHserver": "https://odvr.nic.cz/doh",
"cacheTime": { "cacheTime": {
"resolver": 60, "resolver": 60,
"domain": 60 "domain": 60
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
</section> </section>
<section class="form-section"> <section class="form-section">
<h3>DNS-over-HTTP server</h3> <h3>DNS-over-HTTP server</h3>
<label><input type="radio" name="tlsDns" /> Cloudflare</label> <label><input type="radio" name="DoHserver" /> Cloudflare</label>
<label><input type="radio" name="tlsDns" /> Google</label> <label><input type="radio" name="DoHserver" /> Google</label>
<label class="advanced" <label class="advanced"
><input type="radio" name="tlsDns" value="_custom_"/> custom: ><input type="radio" name="DoHserver" value="_custom_"/> custom:
<input type="text" id="tlsDnsCustom" <input type="text" id="tlsDnsCustom"
/></label> /></label>
</section> </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 => ...@@ -8,7 +8,7 @@ const getTTL = j =>
: config.defaultSettings.cacheTime.domain : config.defaultSettings.cacheTime.domain
const resolveDnssecStatus = async hostname => 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/ // https://developers.cloudflare.com/1.1.1.1/dns-over-https/json-format/
headers: { accept: 'application/dns-json' } headers: { accept: 'application/dns-json' }
}) })
......
...@@ -6,7 +6,7 @@ import Url from 'url-parse' ...@@ -6,7 +6,7 @@ import Url from 'url-parse'
// import settingsStore from './settings' // import settingsStore from './settings'
const protocols = config.supportedProtocols 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 => { const blockRequest = async tabId => {
await storage('tabCounters', 'inc', { id: tabId }) await storage('tabCounters', 'inc', { id: tabId })
......
...@@ -13,30 +13,40 @@ ...@@ -13,30 +13,40 @@
"test": "echo 'not yet'" "test": "echo 'not yet'"
}, },
"devDependencies": { "devDependencies": {
"css-loader": "^2.1.0", "css-loader": "^2.1.1",
"eslint": "^5.12.1", "eslint": "^5.16.0",
"eslint-config-es": "^0.9.1", "eslint-config-es": "^3.0.0",
"eslint-config-standard": "^12.0.0", "eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.15.0", "eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^8.0.1", "eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0", "eslint-plugin-standard": "^4.0.0",
"extract-loader": "^3.1.0", "extract-loader": "^3.1.0",
"file-loader": "^3.0.1", "file-loader": "^3.0.1",
"mini-css-extract-plugin": "^0.5.0", "mini-css-extract-plugin": "^0.7.0",
"node-sass": "^4.11.0", "node-sass": "^4.12.0",
"postcss-clean": "^1.1.0", "postcss-clean": "^1.1.0",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"stylelint": "^9.10.1", "stylelint": "^10.0.1",
"stylelint-config-standard": "^18.2.0", "stylelint-config-standard": "^18.3.0",
"web-ext": "^2.9.3", "web-ext": "^3.0.0",
"web-ext-types": "^3.1.0", "web-ext-types": "^3.1.0",
"stylelint-scss": "^3.5.1", "stylelint-scss": "^3.7.0",
"webextension-toolbox": "^3.0.0" "webextension-toolbox": "^3.0.0"
}, },
"dependencies": { "dependencies": {
"url-parse": "^1.4.4" "@sagi.io/dns-over-https": "0.0.2",
"buffer": "^5.2.1",
"dns-packet": "^5.2.1",
"dohdec": "^2.0.0",
"ip": "^1.1.5",
"isomorphic-fetch": "^2.2.1",
"native-dns-packet": "^0.1.1",
"os": "^0.1.1",
"process": "^0.11.10",
"stream": "0.0.2",
"url-parse": "^1.4.7"
} }
} }
...@@ -23,6 +23,9 @@ module.exports = { ...@@ -23,6 +23,9 @@ module.exports = {
} }
] ]
}) })
config.node = {
process: true
}
return config 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