Skip to content

Commit

Permalink
Basic working version, needs hex decoding maybe?
Browse files Browse the repository at this point in the history
  • Loading branch information
thisismyrobot committed Dec 29, 2018
1 parent e1b1627 commit 1a259ed
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion workers/resolve-worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
/* globals fetch, addEventListener, Headers, Response */
// Route: https://dnstwister.report/api/ip2*
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})

const jsonHeaders = new Headers([['Content-Type', 'application/json']])

async function handleRequest (request) {
return fetch('https://dns.google.com/resolve?name=dnstwister.report')
const parsedUrl = new URL(request.url)
if (!parsedUrl.searchParams.has('ed')) {
return new Response('Missing encoded domain parameter', { status: 403 })
}

let decodedDomain = parsedUrl.searchParams.get('ed')

return fetch('https://dns.google.com/resolve?name=' + decodedDomain)
.then(function (response) {
if (response.ok) {
return response.json()
Expand Down

0 comments on commit 1a259ed

Please sign in to comment.