-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheds.js
33 lines (29 loc) · 989 Bytes
/
eds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const helmet = require('helmet')
const port = process.env.PORT || 3000;
app.use(helmet())
app.use(express.static('public'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json())
app.listen(port, ()=> {
console.log(`EDS listening on port ${port}!`);
});
app.post('/dog', function(req, res) {
const FQDN = req.body.fqdn;
(async () => {
const doh = require('@sagi.io/dns-over-https')
const dnsResponse = await doh.query({name: FQDN, hostname: 'https://dns.google/dns-query'})
const dnsip = dnsResponse.answers
const kakunouko = []
for (let i = 0; i < dnsip.length; i++){
kakunouko.push({record: dnsip[i].type , addresss: dnsip[i].data});
}
res.send(kakunouko);
console.log(kakunouko);
})()
});
app.post('/cat', function(req, res) {
res.send('sample connection was successed!')
});