Commit d2e32583b1db3811574a3dfef0f851a835cb4a50
serve hardcoded responses
ansuz committed on 10/31/2016, 12:10:58 PMParent: ef24d28ffaca3fdebdaafffd13000c69e06f42ee
Files changed
.gitignore | added |
README.md | added |
index.js | added |
package.json | added |
README.md | ||
---|---|---|
@@ -1,0 +1,11 @@ | ||
1 … | +# ssb-dns | |
2 … | + | |
3 … | +It's fairly easy to serve dns from a nodejs process. | |
4 … | + | |
5 … | +[scuttlebot](http://ssbc.github.io/scuttlebot/) makes it easy to work with a peer-to-peer log store. | |
6 … | + | |
7 … | +So let's mash them together. | |
8 … | + | |
9 … | +> What could go wrong? | |
10 … | + | |
11 … | + |
index.js | ||
---|---|---|
@@ -1,0 +1,22 @@ | ||
1 … | +var Dnsd = require("dnsd"); | |
2 … | +var Client = require("ssb-client"); | |
3 … | + | |
4 … | +var createServer = function (port, host, cb) { | |
5 … | + Dnsd.createServer(function(req, res) { | |
6 … | + res.end('1.2.3.4') | |
7 … | + }).listen(port, host, cb) | |
8 … | +}; | |
9 … | + | |
10 … | +Client(function (err, sbot) { | |
11 … | + if (err) { | |
12 … | + console.error(err); | |
13 … | + return void process.exit(1); | |
14 … | + } | |
15 … | + var port = 53053; | |
16 … | + var host = '127.0.0.1'; | |
17 … | + createServer(port, host, function () { | |
18 … | + console.log('Server running at %s:%s', host, port); | |
19 … | + }); | |
20 … | +}); | |
21 … | + | |
22 … | + |
package.json | |||
---|---|---|---|
@@ -1,0 +1,20 @@ | |||
1 … | +{ | ||
2 … | + "name": "ssb-dns", | ||
3 … | + "version": "1.0.0", | ||
4 … | + "description": "resolve dns via ssb", | ||
5 … | + "main": "index.js", | ||
6 … | + "scripts": { | ||
7 … | + "test": "echo \"Error: no test specified\" && exit 1" | ||
8 … | + }, | ||
9 … | + "dependencies": { | ||
10 … | + "dnsd": "^0.9.6", | ||
11 … | + "ssb-client": "^4.0.2" | ||
12 … | + }, | ||
13 … | + "keywords": [ | ||
14 … | + "dns", | ||
15 … | + "ssb", | ||
16 … | + "scuttlebot" | ||
17 … | + ], | ||
18 … | + "author": "ansuz", | ||
19 … | + "license": "AGPL-3.0" | ||
20 … | +} |
Built with git-ssb-web